simplify the raw json parsing

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>

Fixed Tests

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-09-16 10:20:24 +03:00
parent 4053229544
commit 01e98a6ce8
8 changed files with 104 additions and 164 deletions

View File

@ -7,12 +7,15 @@
"italic": true,
"extra": [
{
"extra": "Component!",
"extra": [
"Component!"
],
"bold": false,
"italic": false
}
]
}
],
"expected_output": "<font color=\"red\"><b><i>Hello, </i></b></font><font color=\"red\">Component!</font>"
"expected_output":
"<span style=\"color: red; font-weight: bold; font-style: italic;\">Hello, <span style=\"font-weight: normal; font-style: normal;\">Component!</span></span>"
}

View File

@ -9,5 +9,5 @@
"strikethrough": true
}
],
"expected_output": "<font color=\"blue\"><b><i><u><s>Hello, Component!</s></u></i></b></font>"
"expected_output": "<span style=\"color: blue; font-weight: bold; font-style: italic;\"><s><u>Hello, Component!</u></s></span>"
}

View File

@ -3,7 +3,7 @@
{
"text": "Hello, Component!",
"clickEvent": {
"open_url": true,
"action": "open_url",
"value": "https://google.com"
}
}

View File

@ -10,14 +10,16 @@
"color": "#873600",
"bold": true,
"underlined": true,
"extra": {
"text": "jumped over ",
"color": "blue",
"bold": false,
"underlined": false,
"italic": true,
"strikethrough": true
}
"extra": [
{
"text": "jumped over ",
"color": "blue",
"bold": false,
"underlined": false,
"italic": true,
"strikethrough": true
}
]
},
{
"text": "the lazy dog's back. ",
@ -31,11 +33,13 @@
"text": "1234567890 ",
"color": "black",
"strikethrough": false,
"extra": "How vexingly quick daft zebras jump!"
"extra": [
"How vexingly quick daft zebras jump!"
]
}
]
}
],
"expected_output":
"<font color=\"blue\"><i>The quick </i></font><font color=\"#873600\"><b><u>brown fox </u></b></font><font color=\"blue\"><i><s>jumped over </s></i></font><font color=\"green\"><b><i><u><s>the lazy dog's back. </s></u></i></b></font><font color=\"black\"><b><i><u>1234567890 </u></i></b></font><font color=\"black\"><b><i><u>How vexingly quick daft zebras jump!</u></i></b></font>"
"<span style=\"color: blue; font-style: italic;\">The quick </span><span style=\"color: #873600; font-weight: bold;\"><u>brown fox </u><span style=\"color: blue; font-weight: normal; font-style: italic;\"><s>jumped over </s></span></span><span style=\"color: green; font-weight: bold; font-style: italic;\"><s><u>the lazy dog's back. </u></s><span style=\"color: black;\"><u>1234567890 </u>How vexingly quick daft zebras jump!</span></span>"
}