diff options
author | albert-github <albert.tests@gmail.com> | 2020-04-12 17:17:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-12 17:17:34 (GMT) |
commit | 184ea443799cd27a1e3cd3989c03c183297df890 (patch) | |
tree | de590985c94212cb03b176ab220ef644b8156803 | |
parent | cb6756410130955d0a9704882795f4d701b998c3 (diff) | |
download | Doxygen-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 `\` didn't work as this is already translated by the bowser and still picked up by MathJax, so we need `‍` to separate the backslash and the bracket without any spacing.
-rw-r--r-- | src/htmldocvisitor.cpp | 10 | ||||
-rw-r--r-- | src/htmlgen.cpp | 12 |
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 << "<"; break; case '>': m_t << ">"; break; case '&': m_t << "&"; break; + case '\\': if ((*p == '(') || (*p == ')')) + m_t << "\\‍" << *p++; + else + m_t << c; + break; default: m_t << c; } } @@ -2247,6 +2252,11 @@ void HtmlDocVisitor::filterQuotedCdataAttr(const char* str) case '"': m_t << """; break; case '<': m_t << "<"; break; case '>': m_t << ">"; break; + case '\\': if ((*p == '(') || (*p == ')')) + m_t << "\\‍" << *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 << "<"; p++; } else if (*p=='>') { m_t << ">"; p++; } + else if (*p=='(') + { m_t << "\\‍("; m_col++;p++; } + else if (*p==')') + { m_t << "\\‍)"; m_col++;p++; } else m_t << "\\"; m_col++; @@ -702,6 +706,10 @@ void HtmlCodeGenerator::docify(const char *str) { m_t << "<"; p++; } else if (*p=='>') { m_t << ">"; p++; } + else if (*p=='(') + { m_t << "\\‍("; p++; } + else if (*p==')') + { m_t << "\\‍)"; p++; } else m_t << "\\"; break; @@ -1502,6 +1510,10 @@ void HtmlGenerator::docify(const char *str,bool inHtmlComment) { t << "<"; p++; } else if (*p=='>') { t << ">"; p++; } + else if (*p=='(') + { t << "\\‍("; p++; } + else if (*p==')') + { t << "\\‍)"; p++; } else t << "\\"; break; |