r113184 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113183‎ | r113184 | r113185 >
Date:21:57, 6 March 2012
Author:brion
Status:ok
Tags:1.19, mathjax 
Comment:
Tweak MathJax loading per recommendations from mathjax-users list:
* drop some of the init lines that don't appear to work/be needed
* only load MathJax.js through ResourceLoader; let MathJax's loader handle the rest

This gets us working in Chrome, where previously we hadn't initialized correctly. Should also help in IE, still needs testing.
Will probably want to swap in the pre-minimized versions of the files at some point, but the expanded ones are fine at this stage of work.
Modified paths:
  • /trunk/extensions/Math/Math.php (modified) (history)
  • /trunk/extensions/Math/modules/MathJax-custom/extensions/TeX/texvc.js (deleted) (history)
  • /trunk/extensions/Math/modules/MathJax-custom/extensions/wiki2jax.js (deleted) (history)
  • /trunk/extensions/Math/modules/MathJax/config/TeX-AMS-texvc_HTML.js (added) (history)
  • /trunk/extensions/Math/modules/MathJax/extensions/TeX/texvc.js (added) (history)
  • /trunk/extensions/Math/modules/MathJax/extensions/wiki2jax.js (added) (history)
  • /trunk/extensions/Math/modules/ext.math.mathjax.enabler.js (modified) (history)
  • /trunk/extensions/Math/modules/ext.math.mathjax.preload.js (deleted) (history)

Diff [purge]

Index: trunk/extensions/Math/Math.php
@@ -126,23 +126,8 @@
127127 $wgResourceModules['ext.math.mathjax'] = array(
128128 'scripts' => array(
129129 'MathJax/MathJax.js',
130 - 'ext.math.mathjax.preload.js',
131 - 'MathJax/jax/input/TeX/config.js',
132 - 'MathJax/jax/output/HTML-CSS/config.js',
133 - 'MathJax/extensions/MathEvents.js',
134 - 'MathJax/extensions/MathZoom.js',
135 - 'MathJax/extensions/MathMenu.js',
136 - 'MathJax/jax/element/mml/jax.js',
137 - 'MathJax/extensions/toMathML.js',
138 - 'MathJax/extensions/TeX/noErrors.js',
139 - 'MathJax/extensions/TeX/noUndefined.js',
140 - 'MathJax/jax/input/TeX/jax.js',
141 - 'MathJax/extensions/TeX/AMSmath.js',
142 - 'MathJax/extensions/TeX/AMSsymbols.js',
143 - 'MathJax/jax/output/HTML-CSS/jax.js',
144 - 'MathJax/jax/output/HTML-CSS/autoload/mtable.js',
145 - 'MathJax-custom/extensions/wiki2jax.js',
146 - 'MathJax-custom/extensions/TeX/texvc.js'
 130+ // We'll let the other parts be loaded by MathJax's
 131+ // own module/config loader.
147132 ),
148133 'group' => 'ext.math.mathjax',
149134 ) + $moduleTemplate;
Index: trunk/extensions/Math/modules/ext.math.mathjax.preload.js
@@ -1,17 +0,0 @@
2 -MathJax.Ajax.Preloading(
3 - "[MathJax]/jax/input/TeX/config.js",
4 - "[MathJax]/jax/output/HTML-CSS/config.js",
5 - "[MathJax]/extensions/MathEvents.js",
6 - "[MathJax]/extensions/MathZoom.js",
7 - "[MathJax]/extensions/MathMenu.js",
8 - "[MathJax]/jax/element/mml/jax.js",
9 - "[MathJax]/extensions/toMathML.js",
10 - "[MathJax]/extensions/TeX/noErrors.js",
11 - "[MathJax]/extensions/TeX/noUndefined.js",
12 - "[MathJax]/jax/input/TeX/jax.js",
13 - "[MathJax]/extensions/TeX/AMSmath.js",
14 - "[MathJax]/extensions/TeX/AMSsymbols.js",
15 - "[MathJax]/jax/output/HTML-CSS/jax.js",
16 - "[MathJax]/jax/output/HTML-CSS/autoload/mtable.js"
17 -);
18 -
Index: trunk/extensions/Math/modules/MathJax-custom/extensions/wiki2jax.js
@@ -1,88 +0,0 @@
2 -/**
3 - * From https://en.wikipedia.org/wiki/User:Nageh/mathJax/config/TeX-AMS-texvc_HTML.js
4 - */
5 -
6 -MathJax.Extension.wiki2jax = {
7 - version: "1.0",
8 -
9 - config: {
10 - element: null, // The ID of the element to be processed
11 - // (defaults to full document)
12 -
13 - preview: "TeX" // Set to "none" to prevent preview strings from being inserted
14 - // or to an array that specifies an HTML snippet to use for
15 - // the preview.
16 - },
17 -
18 - PreProcess: function (element) {
19 - if (!this.configured) {
20 - MathJax.Hub.Insert(this.config,(MathJax.Hub.config.wiki2jax||{}));
21 - 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
24 - this.previewClass = MathJax.Hub.config.preRemoveClass;
25 - this.configured = true;
26 - }
27 - var that = this;
28 - $('span.tex, img.tex', element || document).each(function(i, span) {
29 - that.ConvertMath(span);
30 - });
31 - },
32 -
33 - ConvertMath: function (node) {
34 - var parent = node.parentNode,
35 - mode = parent.tagName === "DD" && parent.firstChild === parent.lastChild ? "; mode=display" : "",
36 - tex;
37 - if (node.nodeName == 'IMG') {
38 - tex = node.alt;
39 - } else {
40 - tex = node.innerHTML.substring(node.innerHTML[0]=='$',node.innerHTML.length-(node.innerHTML[node.innerHTML.length-1]=='$'));
41 - tex = tex.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&nbsp;/g," ");
42 - }
43 -
44 - tex = tex.replace(/\\iiint([^!]*)!\\!\\!\\!\\!.*\\subset\\!\\supset/g,"\\iiint$1mkern-2.5em\\subset\\!\\supset").replace(/\\iint([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\subset\\!\\supset/g,"\\iint$1mkern-1.65em$2\\subset\\!\\!\\supset").replace(/\\int\\!\\!\\!(\\!)+\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!.*\\bigcirc(\\,)*/g,"\\iiint$3mkern-2.5em\\subset\\!\\supset").replace(/\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\bigcirc(\\,)*/g,"\\iint$2mkern-1.65em$3\\subset\\!\\!\\supset");
45 - if (mode === "") {
46 - tex = tex.replace(/ *\\scriptstyle(\W)/g,"\\textstyle$1").replace(/ *\\scriptscriptstyle(\W)/g,"\\scriptstyle$1");
47 - if (parent.firstChild === node) tex = "\\displaystyle "+tex;
48 - }
49 -
50 - var i;
51 - while ((i = tex.search(/\\color{/)) != -1) {
52 - var braces = 0;
53 - for (i += 6; i < tex.length; i++) {
54 - if (tex[i] == '{') braces++;
55 - else if (tex[i] == '}') {
56 - if (braces-- == 0)
57 - break;
58 - }
59 - }
60 - tex = (tex.substring(0, i) + "}" + tex.substring(i, tex.length)).replace(/\\color{(\w*)}/, "\\textcolor{$1}{");
61 - }
62 -
63 - var script = document.createElement("script");
64 - script.type = "math/tex" + mode;
65 - if (MathJax.Hub.Browser.isMSIE) {script.text = tex}
66 - else {script.appendChild(document.createTextNode(tex))}
67 -
68 - if (node.nextSibling) {parent.insertBefore(script,node.nextSibling)}
69 - else {parent.appendChild(script)}
70 - if (this.config.preview !== "none") {this.createPreview(node)}
71 - parent.removeChild(node);
72 - },
73 -
74 - createPreview: function (node) {
75 - var preview;
76 - if (this.config.preview === "TeX") {preview = [this.filterTeX(node.innerHTML)]}
77 - else if (this.config.preview instanceof Array) {preview = this.config.preview}
78 - if (preview) {
79 - preview = MathJax.HTML.Element("span",{className: MathJax.Hub.config.preRemoveClass},preview);
80 - node.parentNode.insertBefore(preview,node);
81 - }
82 - },
83 -
84 - filterTeX: function (tex) {return tex}
85 -
86 -};
87 -
88 -MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.wiki2jax]);
89 -MathJax.Ajax.loadComplete("[MathJax]/extensions/wiki2jax.js");
Index: trunk/extensions/Math/modules/MathJax-custom/extensions/TeX/texvc.js
@@ -1,128 +0,0 @@
2 -/**
3 - * From https://en.wikipedia.org/wiki/User:Nageh/mathJax/config/TeX-AMS-texvc_HTML.js
4 - */
5 -
6 -MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
7 - var VERSION = "1.0";
8 -
9 - var MML = MathJax.ElementJax.mml;
10 -
11 - MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions,{
12 -
13 - mathchar0mi: {
14 - // Lowercase Greek letters
15 - thetasym: '03B8', // theta
16 - koppa: '03DF',
17 - stigma: '03DB',
18 - coppa: '03D9', // archaic koppa
19 -
20 - // Ord symbols
21 - C: ['0043',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
22 - cnums: ['0043',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
23 - Complex: ['0043',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
24 - N: ['004E',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
25 - natnums: ['004E',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
26 - R: ['0052',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
27 - reals: ['0052',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
28 - Reals: ['0052',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
29 - Z: ['005A',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
30 - sect: '00A7', // S
31 - P: '00B6',
32 - alef: ['2135',{mathvariant: MML.VARIANT.NORMAL}], // aleph
33 - alefsym: ['2135',{mathvariant: MML.VARIANT.NORMAL}], // aleph
34 - weierp: ['2118',{mathvariant: MML.VARIANT.NORMAL}], // wp
35 - real: ['211C',{mathvariant: MML.VARIANT.NORMAL}], // Re
36 - part: ['2202',{mathvariant: MML.VARIANT.NORMAL}], // partial
37 - infin: ['221E',{mathvariant: MML.VARIANT.NORMAL}], // infty
38 - empty: ['2205',{mathvariant: MML.VARIANT.NORMAL}], // emptyset
39 - O: ['2205',{mathvariant: MML.VARIANT.NORMAL}], // emptyset (but should probably be Swedish O)
40 - ang: ['2220',{mathvariant: MML.VARIANT.NORMAL}], // angle
41 - exist: ['2203',{mathvariant: MML.VARIANT.NORMAL}], // exists
42 - clubs: ['2663',{mathvariant: MML.VARIANT.NORMAL}], // clubsuit
43 - diamonds: ['2662',{mathvariant: MML.VARIANT.NORMAL}], // diamondsuit
44 - hearts: ['2661',{mathvariant: MML.VARIANT.NORMAL}], // heartsuit
45 - spades: ['2660',{mathvariant: MML.VARIANT.NORMAL}], // spadesuit
46 - textvisiblespace: '2423'
47 - },
48 -
49 - mathchar0mo: {
50 - // Binary operators
51 - and: '2227', // land
52 - or: '2228', // lor
53 - bull: '2219', // bullet
54 - plusmn: '00B1', // pm
55 - sdot: '22C5', // cdot
56 -
57 - // Binary relations
58 - sup: '2283', // supset
59 - sub: '2282', // subset
60 - supe: '2287', // supseteq
61 - sube: '2286', // subseteq
62 - isin: '2208', // in
63 -
64 - hAar: '21D4', // Leftrightarrow [sic]
65 - hArr: '21D4', // Leftrightarrow
66 - Harr: '21D4', // Leftrightarrow
67 - Lrarr: '21D4', // Leftrightarrow
68 - lrArr: '21D4', // Leftrightarrow
69 - lArr: '21D0', // Leftarrow
70 - Larr: '21D0', // Leftarrow
71 - rArr: '21D2', // Rightarrow
72 - Rarr: '21D2', // Rightarrow
73 - harr: '2194', // leftrightarrow
74 - lrarr: '2194', // leftrightarrow
75 - larr: '2190', // leftarrow
76 - gets: '2190', // leftarrow
77 - rarr: '2192', // rightarrow
78 -
79 - // big ops
80 - oiint: ['222F',{texClass: MML.TEXCLASS.OP}], // not part of texvc but nice to have
81 - oiiint: ['2230',{texClass: MML.TEXCLASS.OP}]
82 - },
83 -
84 - mathchar7: {
85 - // Uppercase Greek letters
86 - Alpha: '0391',
87 - Beta: '0392',
88 - Epsilon: '0395',
89 - Zeta: '0396',
90 - Eta: '0397',
91 - Iota: '0399',
92 - Kappa: '039A',
93 - Mu: '039C',
94 - Nu: '039D',
95 - Omicron: '039F',
96 - Rho: '03A1',
97 - Tau: '03A4',
98 - Chi: '03A7',
99 -
100 - Koppa: '03DE',
101 - Stigma: '03DA',
102 - Coppa: '03D8' // archaic Koppa
103 - },
104 -
105 - delimiter: {
106 - '\\uarr': '2191', // uparrow
107 - '\\darr': '2193', // downarrow
108 - '\\Uarr': '21D1', // Uparrow
109 - '\\uArr': '21D1', // Uparrow
110 - '\\Darr': '21D3', // Downarrow
111 - '\\dArr': '21D3', // Downarrow
112 - '\\rang': '27E9', // rangle
113 - '\\lang': '27E8' // langle
114 - },
115 -
116 - macros: {
117 - sgn: ['NamedOp',0],
118 - textcolor: ['Macro','\\color{#1}',1],
119 - bold: ['Macro','{\\boldsymbol #1}',1] // boldsymbol
120 - }
121 -
122 - });
123 -});
124 -
125 -MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
126 - MathJax.Hub.Startup.signal.Post("TeX texvc Ready");
127 -});
128 -
129 -MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/texvc.js");
Index: trunk/extensions/Math/modules/ext.math.mathjax.enabler.js
@@ -11,33 +11,14 @@
1212 mathJax.Config = function() {
1313 MathJax.Hub.Config({
1414 root: mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax',
15 - //config: "TeX-AMS-texvc_HTML.js",
 15+ config: ["TeX-AMS-texvc_HTML.js"],
1616 "v1.0-compatible": false,
1717 styles: { ".mtext": { "font-family": "sans-serif ! important", "font-size": "80%" } },
1818 displayAlign: "left",
1919 menuSettings: { zoom: "click" },
2020 "HTML-CSS": { imageFont: null, availableFonts: ["TeX"] }
2121 });
22 - MathJax.Message.styles["#MathJax_Message"].right = MathJax.Message.styles["#MathJax_Message"].left;
23 - delete MathJax.Message.styles["#MathJax_Message"].left;
24 - if ( typeof(mathJax.userConfig) !== "undefined" ) MathJax.Hub.Config( mathJax.userConfig );
25 - //if ( typeof(mathJax.fontDir) !== "undefined" ) MathJax.OutputJax.fontDir = mathJax.fontDir; else MathJax.Hub.Config({ NativeMML: {webFont: null} });
2622 MathJax.OutputJax.fontDir = mathJax.fontDir = mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts';
27 - MathJax.Hub.Register.StartupHook("End Extensions", function() {
28 - var TEX = MathJax.InputJax.TeX;
29 - var MACROS = TEX.config.Macros;
30 - for (var id in MACROS) {
31 - if (typeof(MACROS[id]) === "string") TEX.Macro(id, MACROS[id]);
32 - else TEX.Macro(id, MACROS[id][0], MACROS[id][1]);
33 - }
34 - TEX.Parse.Augment({
35 - Cr: function(name) {
36 - this.GetBrackets(name);
37 - this.Push(TEX.Stack.Item.cell().With({isCR: true, name: name}));
38 - }
39 - });
40 - });
41 - MathJax.Hub.Startup.onload();
4223 }
4324
4425 mathJax.Load = function(element) {
Index: trunk/extensions/Math/modules/MathJax/extensions/TeX/texvc.js
@@ -0,0 +1,128 @@
 2+/**
 3+ * From https://en.wikipedia.org/wiki/User:Nageh/mathJax/config/TeX-AMS-texvc_HTML.js
 4+ */
 5+
 6+MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
 7+ var VERSION = "1.0";
 8+
 9+ var MML = MathJax.ElementJax.mml;
 10+
 11+ MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions,{
 12+
 13+ mathchar0mi: {
 14+ // Lowercase Greek letters
 15+ thetasym: '03B8', // theta
 16+ koppa: '03DF',
 17+ stigma: '03DB',
 18+ coppa: '03D9', // archaic koppa
 19+
 20+ // Ord symbols
 21+ C: ['0043',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 22+ cnums: ['0043',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 23+ Complex: ['0043',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 24+ N: ['004E',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 25+ natnums: ['004E',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 26+ R: ['0052',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 27+ reals: ['0052',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 28+ Reals: ['0052',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 29+ Z: ['005A',{mathvariant: MML.VARIANT.DOUBLESTRUCK}],
 30+ sect: '00A7', // S
 31+ P: '00B6',
 32+ alef: ['2135',{mathvariant: MML.VARIANT.NORMAL}], // aleph
 33+ alefsym: ['2135',{mathvariant: MML.VARIANT.NORMAL}], // aleph
 34+ weierp: ['2118',{mathvariant: MML.VARIANT.NORMAL}], // wp
 35+ real: ['211C',{mathvariant: MML.VARIANT.NORMAL}], // Re
 36+ part: ['2202',{mathvariant: MML.VARIANT.NORMAL}], // partial
 37+ infin: ['221E',{mathvariant: MML.VARIANT.NORMAL}], // infty
 38+ empty: ['2205',{mathvariant: MML.VARIANT.NORMAL}], // emptyset
 39+ O: ['2205',{mathvariant: MML.VARIANT.NORMAL}], // emptyset (but should probably be Swedish O)
 40+ ang: ['2220',{mathvariant: MML.VARIANT.NORMAL}], // angle
 41+ exist: ['2203',{mathvariant: MML.VARIANT.NORMAL}], // exists
 42+ clubs: ['2663',{mathvariant: MML.VARIANT.NORMAL}], // clubsuit
 43+ diamonds: ['2662',{mathvariant: MML.VARIANT.NORMAL}], // diamondsuit
 44+ hearts: ['2661',{mathvariant: MML.VARIANT.NORMAL}], // heartsuit
 45+ spades: ['2660',{mathvariant: MML.VARIANT.NORMAL}], // spadesuit
 46+ textvisiblespace: '2423'
 47+ },
 48+
 49+ mathchar0mo: {
 50+ // Binary operators
 51+ and: '2227', // land
 52+ or: '2228', // lor
 53+ bull: '2219', // bullet
 54+ plusmn: '00B1', // pm
 55+ sdot: '22C5', // cdot
 56+
 57+ // Binary relations
 58+ sup: '2283', // supset
 59+ sub: '2282', // subset
 60+ supe: '2287', // supseteq
 61+ sube: '2286', // subseteq
 62+ isin: '2208', // in
 63+
 64+ hAar: '21D4', // Leftrightarrow [sic]
 65+ hArr: '21D4', // Leftrightarrow
 66+ Harr: '21D4', // Leftrightarrow
 67+ Lrarr: '21D4', // Leftrightarrow
 68+ lrArr: '21D4', // Leftrightarrow
 69+ lArr: '21D0', // Leftarrow
 70+ Larr: '21D0', // Leftarrow
 71+ rArr: '21D2', // Rightarrow
 72+ Rarr: '21D2', // Rightarrow
 73+ harr: '2194', // leftrightarrow
 74+ lrarr: '2194', // leftrightarrow
 75+ larr: '2190', // leftarrow
 76+ gets: '2190', // leftarrow
 77+ rarr: '2192', // rightarrow
 78+
 79+ // big ops
 80+ oiint: ['222F',{texClass: MML.TEXCLASS.OP}], // not part of texvc but nice to have
 81+ oiiint: ['2230',{texClass: MML.TEXCLASS.OP}]
 82+ },
 83+
 84+ mathchar7: {
 85+ // Uppercase Greek letters
 86+ Alpha: '0391',
 87+ Beta: '0392',
 88+ Epsilon: '0395',
 89+ Zeta: '0396',
 90+ Eta: '0397',
 91+ Iota: '0399',
 92+ Kappa: '039A',
 93+ Mu: '039C',
 94+ Nu: '039D',
 95+ Omicron: '039F',
 96+ Rho: '03A1',
 97+ Tau: '03A4',
 98+ Chi: '03A7',
 99+
 100+ Koppa: '03DE',
 101+ Stigma: '03DA',
 102+ Coppa: '03D8' // archaic Koppa
 103+ },
 104+
 105+ delimiter: {
 106+ '\\uarr': '2191', // uparrow
 107+ '\\darr': '2193', // downarrow
 108+ '\\Uarr': '21D1', // Uparrow
 109+ '\\uArr': '21D1', // Uparrow
 110+ '\\Darr': '21D3', // Downarrow
 111+ '\\dArr': '21D3', // Downarrow
 112+ '\\rang': '27E9', // rangle
 113+ '\\lang': '27E8' // langle
 114+ },
 115+
 116+ macros: {
 117+ sgn: ['NamedOp',0],
 118+ textcolor: ['Macro','\\color{#1}',1],
 119+ bold: ['Macro','{\\boldsymbol #1}',1] // boldsymbol
 120+ }
 121+
 122+ });
 123+});
 124+
 125+MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
 126+ MathJax.Hub.Startup.signal.Post("TeX texvc Ready");
 127+});
 128+
 129+MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/texvc.js");
Property changes on: trunk/extensions/Math/modules/MathJax/extensions/TeX/texvc.js
___________________________________________________________________
Added: svn:eol-style
1130 + native
Index: trunk/extensions/Math/modules/MathJax/extensions/wiki2jax.js
@@ -0,0 +1,88 @@
 2+/**
 3+ * From https://en.wikipedia.org/wiki/User:Nageh/mathJax/config/TeX-AMS-texvc_HTML.js
 4+ */
 5+
 6+MathJax.Extension.wiki2jax = {
 7+ version: "1.0",
 8+
 9+ config: {
 10+ element: null, // The ID of the element to be processed
 11+ // (defaults to full document)
 12+
 13+ preview: "TeX" // Set to "none" to prevent preview strings from being inserted
 14+ // or to an array that specifies an HTML snippet to use for
 15+ // the preview.
 16+ },
 17+
 18+ PreProcess: function (element) {
 19+ if (!this.configured) {
 20+ MathJax.Hub.Insert(this.config,(MathJax.Hub.config.wiki2jax||{}));
 21+ 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
 24+ this.previewClass = MathJax.Hub.config.preRemoveClass;
 25+ this.configured = true;
 26+ }
 27+ var that = this;
 28+ $('span.tex, img.tex', element || document).each(function(i, span) {
 29+ that.ConvertMath(span);
 30+ });
 31+ },
 32+
 33+ ConvertMath: function (node) {
 34+ var parent = node.parentNode,
 35+ mode = parent.tagName === "DD" && parent.firstChild === parent.lastChild ? "; mode=display" : "",
 36+ tex;
 37+ if (node.nodeName == 'IMG') {
 38+ tex = node.alt;
 39+ } else {
 40+ tex = node.innerHTML.substring(node.innerHTML[0]=='$',node.innerHTML.length-(node.innerHTML[node.innerHTML.length-1]=='$'));
 41+ tex = tex.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&nbsp;/g," ");
 42+ }
 43+
 44+ tex = tex.replace(/\\iiint([^!]*)!\\!\\!\\!\\!.*\\subset\\!\\supset/g,"\\iiint$1mkern-2.5em\\subset\\!\\supset").replace(/\\iint([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\subset\\!\\supset/g,"\\iint$1mkern-1.65em$2\\subset\\!\\!\\supset").replace(/\\int\\!\\!\\!(\\!)+\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!.*\\bigcirc(\\,)*/g,"\\iiint$3mkern-2.5em\\subset\\!\\supset").replace(/\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\bigcirc(\\,)*/g,"\\iint$2mkern-1.65em$3\\subset\\!\\!\\supset");
 45+ if (mode === "") {
 46+ tex = tex.replace(/ *\\scriptstyle(\W)/g,"\\textstyle$1").replace(/ *\\scriptscriptstyle(\W)/g,"\\scriptstyle$1");
 47+ if (parent.firstChild === node) tex = "\\displaystyle "+tex;
 48+ }
 49+
 50+ var i;
 51+ while ((i = tex.search(/\\color{/)) != -1) {
 52+ var braces = 0;
 53+ for (i += 6; i < tex.length; i++) {
 54+ if (tex[i] == '{') braces++;
 55+ else if (tex[i] == '}') {
 56+ if (braces-- == 0)
 57+ break;
 58+ }
 59+ }
 60+ tex = (tex.substring(0, i) + "}" + tex.substring(i, tex.length)).replace(/\\color{(\w*)}/, "\\textcolor{$1}{");
 61+ }
 62+
 63+ var script = document.createElement("script");
 64+ script.type = "math/tex" + mode;
 65+ if (MathJax.Hub.Browser.isMSIE) {script.text = tex}
 66+ else {script.appendChild(document.createTextNode(tex))}
 67+
 68+ if (node.nextSibling) {parent.insertBefore(script,node.nextSibling)}
 69+ else {parent.appendChild(script)}
 70+ if (this.config.preview !== "none") {this.createPreview(node)}
 71+ parent.removeChild(node);
 72+ },
 73+
 74+ createPreview: function (node) {
 75+ var preview;
 76+ if (this.config.preview === "TeX") {preview = [this.filterTeX(node.innerHTML)]}
 77+ else if (this.config.preview instanceof Array) {preview = this.config.preview}
 78+ if (preview) {
 79+ preview = MathJax.HTML.Element("span",{className: MathJax.Hub.config.preRemoveClass},preview);
 80+ node.parentNode.insertBefore(preview,node);
 81+ }
 82+ },
 83+
 84+ filterTeX: function (tex) {return tex}
 85+
 86+};
 87+
 88+MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.wiki2jax]);
 89+MathJax.Ajax.loadComplete("[MathJax]/extensions/wiki2jax.js");
Property changes on: trunk/extensions/Math/modules/MathJax/extensions/wiki2jax.js
___________________________________________________________________
Added: svn:eol-style
190 + native
Index: trunk/extensions/Math/modules/MathJax/config/TeX-AMS-texvc_HTML.js
@@ -0,0 +1,6 @@
 2+MathJax.Hub.Config({
 3+ extensions: ["wiki2jax.js","TeX/texvc.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js"],
 4+ jax: ["input/TeX","output/HTML-CSS"],
 5+ TeX: {extensions: ["noErrors.js","noUndefined.js","AMSmath.js","AMSsymbols.js"]}
 6+});
 7+MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS-texvc_HTML.js");

Status & tagging log