mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 02:45:38 +00:00
fix escaping / unescaping of latex formula in html code
REVIEW: 102984
This commit is contained in:
parent
3b272175ea
commit
40620cb44f
|
@ -68,6 +68,9 @@ LatexRenderer::Error LatexRenderer::renderLatexInHtml( QString& html, const QCol
|
|||
if (formul.isEmpty() || !securityCheck(formul))
|
||||
continue;
|
||||
|
||||
//unescape formula
|
||||
formul.replace(">",">").replace("<","<").replace("&","&").replace(""","\"").replace("'","\'").replace("<br>"," ");
|
||||
|
||||
QString fileName;
|
||||
Error returnCode = handleLatex(fileName, formul, textColor, fontSize, resolution, latexOutput);
|
||||
if (returnCode != NoError)
|
||||
|
@ -89,7 +92,7 @@ LatexRenderer::Error LatexRenderer::renderLatexInHtml( QString& html, const QCol
|
|||
imagePxWidth = theImage.width();
|
||||
imagePxHeight = theImage.height();
|
||||
QString escapedLATEX=Qt::escape(it.key()).replace('\"',"""); //we need the escape quotes because that string will be in a title="" argument, but not the \n
|
||||
html.replace(Qt::escape(it.key()), " <img width=\"" + QString::number(imagePxWidth) + "\" height=\"" + QString::number(imagePxHeight) + "\" align=\"middle\" src=\"" + (*it) + "\" alt=\"" + escapedLATEX +"\" title=\"" + escapedLATEX +"\" /> ");
|
||||
html.replace(it.key(), " <img width=\"" + QString::number(imagePxWidth) + "\" height=\"" + QString::number(imagePxHeight) + "\" align=\"middle\" src=\"" + (*it) + "\" alt=\"" + escapedLATEX +"\" title=\"" + escapedLATEX +"\" /> ");
|
||||
}
|
||||
return NoError;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue