summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2020-04-12 17:17:34 (GMT)
committerGitHub <noreply@github.com>2020-04-12 17:17:34 (GMT)
commit184ea443799cd27a1e3cd3989c03c183297df890 (patch)
treede590985c94212cb03b176ab220ef644b8156803
parentcb6756410130955d0a9704882795f4d701b998c3 (diff)
downloadDoxygen-184ea443799cd27a1e3cd3989c03c183297df890.zip
Doxygen-184ea443799cd27a1e3cd3989c03c183297df890.tar.gz
Doxygen-184ea443799cd27a1e3cd3989c03c183297df890.tar.bz2
Text show as formula when USE_MATHJAX=YES (#7697)
When having a line of code like: ``` callback_check = re.compile(r'([^\(]*\(.*)(\* *)(\).*\(.*\))') ``` this is seen as an incomplete formula when using MathJax, the `\(` is seen as start of a MathJax formula. Replacing the backslash by the corresponding code `&#92;` didn't work as this is already translated by the bowser and still picked up by MathJax, so we need `&zwj;` to separate the backslash and the bracket without any spacing.
-rw-r--r--src/htmldocvisitor.cpp10
-rw-r--r--src/htmlgen.cpp12
2 files changed, 22 insertions, 0 deletions
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index bb35cae..ea2dffb 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -2226,6 +2226,11 @@ void HtmlDocVisitor::filter(const char *str)
case '<': m_t << "&lt;"; break;
case '>': m_t << "&gt;"; break;
case '&': m_t << "&amp;"; break;
+ case '\\': if ((*p == '(') || (*p == ')'))
+ m_t << "\\&zwj;" << *p++;
+ else
+ m_t << c;
+ break;
default: m_t << c;
}
}
@@ -2247,6 +2252,11 @@ void HtmlDocVisitor::filterQuotedCdataAttr(const char* str)
case '"': m_t << "&quot;"; break;
case '<': m_t << "&lt;"; break;
case '>': m_t << "&gt;"; break;
+ case '\\': if ((*p == '(') || (*p == ')'))
+ m_t << "\\&zwj;" << *p++;
+ else
+ m_t << c;
+ break;
default: m_t << c;
}
}
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index ac42a6a..b157881 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -668,6 +668,10 @@ void HtmlCodeGenerator::codify(const char *str)
{ m_t << "&lt;"; p++; }
else if (*p=='>')
{ m_t << "&gt;"; p++; }
+ else if (*p=='(')
+ { m_t << "\\&zwj;("; m_col++;p++; }
+ else if (*p==')')
+ { m_t << "\\&zwj;)"; m_col++;p++; }
else
m_t << "\\";
m_col++;
@@ -702,6 +706,10 @@ void HtmlCodeGenerator::docify(const char *str)
{ m_t << "&lt;"; p++; }
else if (*p=='>')
{ m_t << "&gt;"; p++; }
+ else if (*p=='(')
+ { m_t << "\\&zwj;("; p++; }
+ else if (*p==')')
+ { m_t << "\\&zwj;)"; p++; }
else
m_t << "\\";
break;
@@ -1502,6 +1510,10 @@ void HtmlGenerator::docify(const char *str,bool inHtmlComment)
{ t << "&lt;"; p++; }
else if (*p=='>')
{ t << "&gt;"; p++; }
+ else if (*p=='(')
+ { t << "\\&zwj;("; p++; }
+ else if (*p==')')
+ { t << "\\&zwj;)"; p++; }
else
t << "\\";
break;