From 40620cb44fb88db10bb731ac584dae444794e4ed Mon Sep 17 00:00:00 2001 From: Niels Ole Salscheider Date: Sat, 29 Oct 2011 15:03:30 +0200 Subject: [PATCH] fix escaping / unescaping of latex formula in html code REVIEW: 102984 --- ui/latexrenderer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/latexrenderer.cpp b/ui/latexrenderer.cpp index 75a11f41c..c012884fb 100644 --- a/ui/latexrenderer.cpp +++ b/ui/latexrenderer.cpp @@ -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("
"," "); + 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()), " \"" "); + html.replace(it.key(), " \"" "); } return NoError; }