Skip to content

Commit 50b46de

Browse files
committed
src/definition/structuredrichtext: don't use glossary style for sc text
When adding structured content text, don't use glossary styles when replacing bullet points. This setting is intended for legacy dictionaries, not structured content.
1 parent 575682d commit 50b46de

2 files changed

Lines changed: 5 additions & 15 deletions

File tree

src/definition/structuredrichtext.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,7 @@ QString StructuredRichText::parse(
108108
switch (val.type())
109109
{
110110
case QJsonValue::Type::String:
111-
glossary += escapeHtml(val.toString()).replace(
112-
'\n',
113-
"<br>"
114-
);
111+
glossary += escapeHtml(val.toString()).replace('\n', "<br>");
115112
break;
116113

117114
case QJsonValue::Type::Object:
@@ -127,7 +124,7 @@ QString StructuredRichText::parse(
127124
}
128125
else if (obj[KEY_TYPE] == VALUE_TYPE_TEXT)
129126
{
130-
addText(obj, style, glossary);
127+
addText(obj, glossary);
131128
}
132129
break;
133130
}
@@ -1070,14 +1067,10 @@ void StructuredRichText::addImage(
10701067
}
10711068
}
10721069

1073-
void StructuredRichText::addText(
1074-
const QJsonObject &obj, Setting::GlossaryStyle style, QString &out) const
1070+
void StructuredRichText::addText(const QJsonObject &obj, QString &out) const
10751071
{
10761072
constexpr const char *KEY_TEXT = "text";
1077-
out += escapeHtml(obj[KEY_TEXT].toString()).replace(
1078-
'\n',
1079-
style == Setting::GlossaryStyleBullet ? "</li><li>" : "<br>"
1080-
);
1073+
out += escapeHtml(obj[KEY_TEXT].toString()).replace('\n', "<br>");
10811074
}
10821075

10831076
/* End Other Object Parsers */

src/definition/structuredrichtext.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,9 @@ class StructuredRichText : public QObject
231231
* @brief Add a text object to the HTML document.
232232
*
233233
* @param obj The text object.
234-
* @param style The glossary style to display.
235234
* @param[out] out The string the formatted text will be appended to.
236235
*/
237-
void addText(
238-
const QJsonObject &obj, Setting::GlossaryStyle style, QString &out
239-
) const;
236+
void addText(const QJsonObject &obj, QString &out) const;
240237

241238
/**
242239
* Determines if an array contains structured content.

0 commit comments

Comments
 (0)