diff options
Diffstat (limited to 'src/htmlgen.cpp')
-rw-r--r-- | src/htmlgen.cpp | 109 |
1 files changed, 46 insertions, 63 deletions
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index ad8782b..86825e4 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -449,17 +449,25 @@ static QCString substituteHtmlKeywords(const QCString &str, if (mathJaxVersion == "MathJax_3") { - mathJaxJs += "<script>\n" - " window.MathJax = {\n" - " options: {\n" - " ignoreHtmlClass: 'tex2jax_ignore',\n" - " processHtmlClass: 'tex2jax_process'\n" - " },\n"; + mathJaxJs += "<script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n" + "<script type=\"text/javascript\">\n" + "window.MathJax = {\n" + " options: {\n" + " ignoreHtmlClass: 'tex2jax_ignore',\n" + " processHtmlClass: 'tex2jax_process'\n" + " }"; const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); if (!mathJaxExtensions.empty() || !g_latex_macro.isEmpty()) { - mathJaxJs+= " tex: {\n" - " packages: ['base'"; + mathJaxJs+= ",\n" + " tex: {\n" + " macros: {"; + if (!g_latex_macro.isEmpty()) + { + mathJaxJs += g_latex_macro+" "; + } + mathJaxJs+="},\n" + " packages: ['base','configmacros'"; if (!g_latex_macro.isEmpty()) { mathJaxJs+= ",'newcommand'"; @@ -469,49 +477,30 @@ static QCString substituteHtmlKeywords(const QCString &str, mathJaxJs+= ",'"+QCString(s.c_str())+"'"; } mathJaxJs += "]\n" - " },\n" - " tex: {\n" - " macros: {}\n" - " }\n"; + " }\n"; } - mathJaxJs += " };\n"; - mathJaxJs += "</script>\n"; - - if (!g_latex_macro.isEmpty()) + else { - mathJaxJs += "<script>\n" - " Object.assign(MathJax.tex.macros, {\n"; - mathJaxJs += g_latex_macro; - mathJaxJs += "\n" - " });\n" - "</script>\n"; + mathJaxJs += "\n"; } - + mathJaxJs += "};\n"; // MATHJAX_CODEFILE if (!g_mathjax_code.isEmpty()) { - mathJaxJs += "<script>\n"; mathJaxJs += g_mathjax_code; mathJaxJs += "\n"; - mathJaxJs += "</script>\n"; } + mathJaxJs += "</script>\n"; - - mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" + path; - if (mathJaxFormat == "chtml") - { - mathJaxJs += "es5/tex-chtml.js\"></script>\n" ; - } - else if (mathJaxFormat == "SVG") - { - mathJaxJs += "es5/tex-svg.js\"></script>\n" ; - } + mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" + + path + "es5/tex-" + mathJaxFormat.lower() + ".js\">"; + mathJaxJs+="</script>\n"; } - else + else // MathJax v2 { mathJaxJs = "<script type=\"text/x-mathjax-config\">\n" - " MathJax.Hub.Config({\n" - " extensions: [\"tex2jax.js\""; + "MathJax.Hub.Config({\n" + " extensions: [\"tex2jax.js\""; const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); for (const auto &s : mathJaxExtensions) { @@ -522,25 +511,21 @@ static QCString substituteHtmlKeywords(const QCString &str, mathJaxFormat = "HTML-CSS"; } mathJaxJs += "],\n" - " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n" - "});\n"; + " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n"; + if (!g_latex_macro.isEmpty()) + { + mathJaxJs += " TeX: { Macros: {\n"; + mathJaxJs += g_latex_macro; + mathJaxJs += "\n" + " } }\n"; + } + mathJaxJs += "});\n"; if (!g_mathjax_code.isEmpty()) { mathJaxJs += g_mathjax_code; mathJaxJs += "\n"; } mathJaxJs += "</script>\n"; - if (!g_latex_macro.isEmpty()) - { - mathJaxJs += "<script type=\"text/x-mathjax-config\">\n" - " MathJax.Hub.Config({\n" - " TeX: { Macros: {\n"; - mathJaxJs += g_latex_macro; - mathJaxJs += "\n" - " } }\n" - "});\n" - "</script>\n"; - } mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n"; } } @@ -999,13 +984,7 @@ void HtmlGenerator::init() t << mgr.getAsString("dynsections.js"); if (Config_getBool(SOURCE_BROWSER) && Config_getBool(SOURCE_TOOLTIPS)) { - t << - "\n$(document).ready(function() {\n" - " $('.code,.codeRef').each(function() {\n" - " $(this).data('powertip',$('#a'+$(this).attr('href').replace(/.*\\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());\n" - " $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });\n" - " });\n" - "});\n"; + t << mgr.getAsString("dynsections_tooltips.js"); } } } @@ -2501,7 +2480,7 @@ static void writeDefaultQuickLinks(TextStream &t,bool compact, t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>\n"; t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>\n"; t << "<script type=\"text/javascript\">\n"; - t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; + t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; t << "$(function() {\n"; t << " initMenu('" << relPath << "'," << (searchEngine?"true":"false") << "," @@ -2516,14 +2495,13 @@ static void writeDefaultQuickLinks(TextStream &t,bool compact, } else { - t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; t << " $(document).ready(function() {\n" << " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n" << " });\n"; } } t << "});\n"; - t << "/* @license-end */"; + t << "/* @license-end */\n"; t << "</script>\n"; t << "<div id=\"main-nav\"></div>\n"; } @@ -2894,14 +2872,14 @@ void HtmlGenerator::startHeaderSection() void HtmlGenerator::startTitleHead(const QCString &) { - m_t << " <div class=\"headertitle\">\n"; + m_t << " <div class=\"headertitle\">"; startTitle(); } void HtmlGenerator::endTitleHead(const QCString &,const QCString &) { endTitle(); - m_t << " </div>\n"; + m_t << "</div>\n"; } void HtmlGenerator::endHeaderSection() @@ -3074,3 +3052,8 @@ void HtmlGenerator::addWord(const QCString &word,bool hiPriority) Doxygen::searchIndex->addWord(word,hiPriority); } } + +QCString HtmlGenerator::getMathJaxMacros() +{ + return getConvertLatexMacro(); +} |