r113661 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113660‎ | r113661 | r113662 >
Date:20:41, 12 March 2012
Author:brion
Status:ok
Tags:1.19, mathjax 
Comment:
tweaks to MathJax setup & customizations from mathjax-users list

Some fixes, cleanup, and modernization
Modified paths:
  • /trunk/extensions/Math/modules/MathJax/config/TeX-AMS-texvc_HTML.js (modified) (history)
  • /trunk/extensions/Math/modules/MathJax/extensions/TeX/texvc.js (modified) (history)
  • /trunk/extensions/Math/modules/MathJax/extensions/wiki2jax.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Math/modules/MathJax/extensions/TeX/texvc.js
@@ -113,16 +113,14 @@
114114 },
115115
116116 macros: {
117 - sgn: ['NamedOp',0],
 117+ sgn: 'NamedFn',
118118 textcolor: ['Macro','\\color{#1}',1],
119 - bold: ['Macro','{\\boldsymbol #1}',1] // boldsymbol
 119+ bold: ['Macro','\\boldsymbol'] // boldsymbol
120120 }
121121
122122 });
123123 });
124124
125 -MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
126 - MathJax.Hub.Startup.signal.Post("TeX texvc Ready");
127 -});
 125+MathJax.Hub.Startup.signal.Post("TeX texvc Ready");
128126
129127 MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/texvc.js");
Index: trunk/extensions/Math/modules/MathJax/extensions/wiki2jax.js
@@ -16,10 +16,9 @@
1717
1818 PreProcess: function (element) {
1919 if (!this.configured) {
20 - MathJax.Hub.Insert(this.config,(MathJax.Hub.config.wiki2jax||{}));
 20+ this.config = MathJax.Hub.CombineConfig("wiki2jax", this.config);
2121 if (this.config.Augment) {MathJax.Hub.Insert(this,this.config.Augment)}
22 - if (typeof(this.config.previewTeX) !== "undefined" && !this.config.previewTeX)
23 - {this.config.preview = "none"} // backward compatibility for previewTeX parameter
 22+
2423 this.previewClass = MathJax.Hub.config.preRemoveClass;
2524 this.configured = true;
2625 }
@@ -31,7 +30,7 @@
3231
3332 ConvertMath: function (node) {
3433 var parent = node.parentNode,
35 - mode = parent.tagName === "DD" && parent.firstChild === parent.lastChild ? "; mode=display" : "",
 34+ mode = parent.tagName === "DD" && parent.childNodes.length === 1 ? "; mode=display" : "",
3635 tex;
3736 if (node.nodeName == 'IMG') {
3837 tex = node.alt;
@@ -46,6 +45,7 @@
4746 if (parent.firstChild === node) tex = "\\displaystyle{"+tex+"}";
4847 }
4948
 49+ // @fixme auto-enable the 'color' extension and drop this
5050 var i;
5151 while ((i = tex.search(/\\color{/)) != -1) {
5252 var braces = 0;
@@ -61,8 +61,7 @@
6262
6363 var script = document.createElement("script");
6464 script.type = "math/tex" + mode;
65 - if (MathJax.Hub.Browser.isMSIE) {script.text = tex}
66 - else {script.appendChild(document.createTextNode(tex))}
 65+ MathJax.HTML.setScript(script, tex);
6766
6867 if (node.nextSibling) {parent.insertBefore(script,node.nextSibling)}
6968 else {parent.appendChild(script)}
@@ -80,7 +79,7 @@
8180 }
8281 },
8382
84 - filterTeX: function (tex) {return tex}
 83+ filterPreview: function (tex) {return tex}
8584
8685 };
8786
Index: trunk/extensions/Math/modules/MathJax/config/TeX-AMS-texvc_HTML.js
@@ -1,6 +1,6 @@
22 MathJax.Hub.Config({
3 - extensions: ["wiki2jax.js","TeX/texvc.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js"],
 3+ extensions: ["wiki2jax.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js"],
44 jax: ["input/TeX","output/HTML-CSS"],
5 - TeX: {extensions: ["noErrors.js","noUndefined.js","AMSmath.js","AMSsymbols.js"]}
 5+ TeX: {extensions: ["noErrors.js","noUndefined.js","AMSmath.js","AMSsymbols.js","texvc.js"]}
66 });
77 MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS-texvc_HTML.js");

Follow-up revisions

RevisionCommit summaryAuthorDate
r113666followup r113661 - fix for renamed funcbrion20:59, 12 March 2012

Status & tagging log