From 8e44571521391403e8d85f893acb926e021e926b Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 11 Jan 2015 19:56:26 +0100 Subject: Bug 739680 - Using HTML entities in PROJECT_NAME Implementation for LaTeX of special symbols by scanning string in case a & is found. --- src/util.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index 00173fb..1bd2ce9 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6452,6 +6452,8 @@ void filterLatexString(FTextStream &t,const char *str, //printf("filterLatexString(%s)\n",str); //if (strlen(str)<2) stackTrace(); const unsigned char *p=(const unsigned char *)str; + const unsigned char *q; + int cnt; unsigned char c; unsigned char pc='\0'; while (*p) @@ -6478,7 +6480,34 @@ void filterLatexString(FTextStream &t,const char *str, case '$': t << "\\$"; break; case '%': t << "\\%"; break; case '^': t << "$^\\wedge$"; break; - case '&': t << "\\&"; break; + case '&': // possibility to have a special symbol + q = p; + cnt = 2; // we have to count & and ; as well + while (*q && *q != ';') + { + cnt++; + q++; + } + if (*q == ';') + { + --p; // we need & as well + DocSymbol::SymType res = HtmlEntityMapper::instance()->name2sym(QCString((char *)p).left(cnt)); + if (res == DocSymbol::Sym_Unknown) + { + p++; + t << "\\&"; + } + else + { + t << HtmlEntityMapper::instance()->latex(res); + p = q; + } + } + else + { + t << "\\&"; + } + break; case '*': t << "$\\ast$"; break; case '_': if (!insideTabbing) t << "\\+"; t << "\\_"; -- cgit v0.12