gui: PreviewGeneratorPlainText: Escape html before working on text
We use this semi-HTML mode to highlight words, but if we already have tags in the document this does not work quite well. Thus, escape the string before further processing it
Dieser Commit ist enthalten in:
Ursprung
2df273dee3
Commit
1edfcc8f23
@ -58,6 +58,7 @@ QString PreviewGeneratorPlainText::generatePreviewText(QString content, RenderCo
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resulText = resulText.toHtmlEscaped();
|
||||||
QString header = "<b>" + fileName + "</b> ";
|
QString header = "<b>" + fileName + "</b> ";
|
||||||
for(QString &word : config.wordsToHighlight)
|
for(QString &word : config.wordsToHighlight)
|
||||||
{
|
{
|
||||||
@ -112,7 +113,6 @@ QString PreviewGeneratorPlainText::generateLineBasedPreviewText(QTextStream &in,
|
|||||||
if(containsRegex || contains)
|
if(containsRegex || contains)
|
||||||
{
|
{
|
||||||
currentSnippet.wordCountMap[word] = currentSnippet.wordCountMap.value(word, 0) + 1;
|
currentSnippet.wordCountMap[word] = currentSnippet.wordCountMap.value(word, 0) + 1;
|
||||||
|
|
||||||
QString replacementString = "<span style=\"background-color: yellow;\">" + word + "</span>";
|
QString replacementString = "<span style=\"background-color: yellow;\">" + word + "</span>";
|
||||||
if(containsRegex)
|
if(containsRegex)
|
||||||
{
|
{
|
||||||
@ -132,6 +132,7 @@ QString PreviewGeneratorPlainText::generateLineBasedPreviewText(QTextStream &in,
|
|||||||
unsigned int lineCount = 0;
|
unsigned int lineCount = 0;
|
||||||
while(in.readLineInto(¤tLine))
|
while(in.readLineInto(¤tLine))
|
||||||
{
|
{
|
||||||
|
currentLine = currentLine.toHtmlEscaped();
|
||||||
++lineCount;
|
++lineCount;
|
||||||
bool matched = false;
|
bool matched = false;
|
||||||
if(justReadLinesCount > 0)
|
if(justReadLinesCount > 0)
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren