Fix problem with element parameter to the preprocessors (by making a global parameter instead, so there is only one place it needs to be set). Also make it an array so that more than one element can be specified.

This commit is contained in:
Davide P. Cervone 2011-03-18 18:38:51 -04:00
parent 2051c9aa58
commit 536eece1b1
18 changed files with 90 additions and 58 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -174,6 +174,16 @@ MathJax.Hub.Config({
// //
skipStartupTypeset: false, skipStartupTypeset: false,
//
// A list of element ID's that are the ones to process for mathematics
// when any of the Hub typesetting calls (Typeset, Process, Update, etc)
// are called with no element specified. This lets you restrict the
// processing to particular containers rather than scanning the entire
// document for mathematics. If none are supplied, the entire document
// is processed.
//
elements: [],
//============================================================================ //============================================================================
// //
// These parameters control the tex2jax preprocessor (when you have included // These parameters control the tex2jax preprocessor (when you have included

View File

@ -12,5 +12,5 @@
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
*/ */
MathJax.Extension.jsMath2jax={version:"1.1",config:{element:null,preview:"TeX"},PreProcess:function(b){if(!this.configured){this.config=MathJax.Hub.CombineConfig("jsMath2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}if(typeof(this.config.previewTeX)!=="undefined"&&!this.config.previewTeX){this.config.preview="none"}this.previewClass=MathJax.Hub.config.preRemoveClass;this.configured=true}if(typeof(b)==="string"){b=document.getElementById(b)}if(!b){b=this.config.element||document.body}var c=b.getElementsByTagName("span"),a;for(a=c.length-1;a>=0;a--){if(String(c[a].className).match(/(^| )math( |$)/)){this.ConvertMath(c[a],"")}}var d=b.getElementsByTagName("div");for(a=d.length-1;a>=0;a--){if(String(d[a].className).match(/(^| )math( |$)/)){this.ConvertMath(d[a],"; mode=display")}}},ConvertMath:function(c,d){if(c.getElementsByTagName("script").length===0){var b=c.parentNode,a=this.createMathTag(d,c.innerHTML);if(c.nextSibling){b.insertBefore(a,c.nextSibling)}else{b.appendChild(a)}if(this.config.preview!=="none"){this.createPreview(c)}b.removeChild(c)}},createPreview:function(a){var b;if(this.config.preview==="TeX"){b=[this.filterTeX(a.innerHTML)]}else{if(this.config.preview instanceof Array){b=this.config.preview}}if(b){b=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},b);a.parentNode.insertBefore(b,a)}},createMathTag:function(c,b){b=b.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");var a=document.createElement("script");a.type="math/tex"+c;MathJax.HTML.setScript(a,b);return a},filterTeX:function(a){return a}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js"); MathJax.Extension.jsMath2jax={version:"1.1.1",config:{preview:"TeX"},PreProcess:function(b){if(!this.configured){this.config=MathJax.Hub.CombineConfig("jsMath2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}if(typeof(this.config.previewTeX)!=="undefined"&&!this.config.previewTeX){this.config.preview="none"}this.previewClass=MathJax.Hub.config.preRemoveClass;this.configured=true}if(typeof(b)==="string"){b=document.getElementById(b)}if(!b){b=document.body}var c=b.getElementsByTagName("span"),a;for(a=c.length-1;a>=0;a--){if(String(c[a].className).match(/(^| )math( |$)/)){this.ConvertMath(c[a],"")}}var d=b.getElementsByTagName("div");for(a=d.length-1;a>=0;a--){if(String(d[a].className).match(/(^| )math( |$)/)){this.ConvertMath(d[a],"; mode=display")}}},ConvertMath:function(c,d){if(c.getElementsByTagName("script").length===0){var b=c.parentNode,a=this.createMathTag(d,c.innerHTML);if(c.nextSibling){b.insertBefore(a,c.nextSibling)}else{b.appendChild(a)}if(this.config.preview!=="none"){this.createPreview(c)}b.removeChild(c)}},createPreview:function(a){var b;if(this.config.preview==="TeX"){b=[this.filterTeX(a.innerHTML)]}else{if(this.config.preview instanceof Array){b=this.config.preview}}if(b){b=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},b);a.parentNode.insertBefore(b,a)}},createMathTag:function(c,b){b=b.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");var a=document.createElement("script");a.type="math/tex"+c;MathJax.HTML.setScript(a,b);return a},filterTeX:function(a){return a}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js");

View File

@ -12,5 +12,5 @@
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
*/ */
MathJax.Extension.mml2jax={version:"1.1",config:{element:null,preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=this.config.element||document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d=document.getElementsByTagName("html")[0];if(d){for(var c=0,b=d.attributes.length;c<b;c++){var a=d.attributes[c];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.msieMathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.msieProcessMath(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.msieScriptBug){var b=this.msieOuterHTML(e);b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");MathJax.HTML.setScript(a,b.replace(/&nbsp;/g,"&#xA0;"));d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},msieProcessMath:function(e){var c=e.parentNode;var a=document.createElement("script");a.type="math/mml";c.insertBefore(a,e);var b="",d;while(e&&e.nodeName!=="/MATH"){d=e;e=e.nextSibling;b+=this.msieNodeHTML(d);d.parentNode.removeChild(d)}if(e&&e.nodeName==="/MATH"){e.parentNode.removeChild(e)}a.text=b+"</math>";if(this.config.preview!=="none"){this.createPreview(e,a)}},msieNodeHTML:function(d){var c,b,a;if(d.nodeName==="#text"){c=d.nodeValue.replace(/&/g,"&#x26;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}else{if(d.nodeName==="#comment"){c="<!--"+d.nodeValue+"-->"}else{if(this.msieAttributeBug){c="<"+d.nodeName.toLowerCase();for(b=0,a=d.attributes.length;b<a;b++){if(d.attributes[b].specified){c+=" "+d.attributes[b].nodeName.toLowerCase()+"=";c+='"'+d.attributes[b].nodeValue.replace(/\"/g,'\\"')+'"'}}c+=">"}else{c=this.toLowerCase(d.outerHTML);var e=c.split(/\"/);for(b=0,a=e.length;b<a;b+=2){e[b]=e[b].toLowerCase()}c=e.join('"')}}}return c},msieOuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.msieNodeHTML(d)}if(!this.msieAttributeBug){return d.outerHTML}var c=this.msieNodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.msieOuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},createPreview:function(b,a){var c;if(this.config.preview==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterText(d)]}}else{if(this.config.preview instanceof Array){c=this.config.preview}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterText:function(a){return a},InitBrowser:function(){MathJax.Hub.Browser.Select({MSIE:function(a){var b=MathJax.HTML.Element("span",{className:"mathjax"});MathJax.Hub.Insert(MathJax.Extension.mml2jax,{msieScriptBug:true,msieMathTagBug:(MathJax.HTML.Element("span",{innerHTML:"<math><mi>x</mi></math>"}).childNodes.length!==1),msieAttributeBug:(b.outerHTML.substr(12)!=='"')})}})}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js"); MathJax.Extension.mml2jax={version:"1.1.1",config:{preview:"alttext"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=document.body}this.ProcessMathArray(e.getElementsByTagName("math"));if(e.getElementsByTagNameNS){this.ProcessMathArray(e.getElementsByTagNameNS(this.MMLnamespace,"math"))}var d=document.getElementsByTagName("html")[0];if(d){for(var c=0,b=d.attributes.length;c<b;c++){var a=d.attributes[c];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.ProcessMathArray(e.getElementsByTagName(a.nodeName.substr(6)+":math"))}}}},ProcessMathArray:function(b){var a;if(b.length){if(this.msieMathTagBug){for(a=b.length-1;a>=0;a--){if(b[a].nodeName==="MATH"){this.msieProcessMath(b[a])}else{this.ProcessMath(b[a])}}}else{for(a=b.length-1;a>=0;a--){this.ProcessMath(b[a])}}}},ProcessMath:function(e){var d=e.parentNode;var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.msieScriptBug){var b=this.msieOuterHTML(e);b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");MathJax.HTML.setScript(a,b.replace(/&nbsp;/g,"&#xA0;"));d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},msieProcessMath:function(e){var c=e.parentNode;var a=document.createElement("script");a.type="math/mml";c.insertBefore(a,e);var b="",d;while(e&&e.nodeName!=="/MATH"){d=e;e=e.nextSibling;b+=this.msieNodeHTML(d);d.parentNode.removeChild(d)}if(e&&e.nodeName==="/MATH"){e.parentNode.removeChild(e)}a.text=b+"</math>";if(this.config.preview!=="none"){this.createPreview(e,a)}},msieNodeHTML:function(d){var c,b,a;if(d.nodeName==="#text"){c=d.nodeValue.replace(/&/g,"&#x26;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}else{if(d.nodeName==="#comment"){c="<!--"+d.nodeValue+"-->"}else{if(this.msieAttributeBug){c="<"+d.nodeName.toLowerCase();for(b=0,a=d.attributes.length;b<a;b++){if(d.attributes[b].specified){c+=" "+d.attributes[b].nodeName.toLowerCase()+"=";c+='"'+d.attributes[b].nodeValue.replace(/\"/g,'\\"')+'"'}}c+=">"}else{c=this.toLowerCase(d.outerHTML);var e=c.split(/\"/);for(b=0,a=e.length;b<a;b+=2){e[b]=e[b].toLowerCase()}c=e.join('"')}}}return c},msieOuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.msieNodeHTML(d)}if(!this.msieAttributeBug){return d.outerHTML}var c=this.msieNodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.msieOuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},createPreview:function(b,a){var c;if(this.config.preview==="alttext"){var d=b.getAttribute("alttext");if(d!=null){c=[this.filterText(d)]}}else{if(this.config.preview instanceof Array){c=this.config.preview}}if(c){c=MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},c);a.parentNode.insertBefore(c,a)}},filterText:function(a){return a},InitBrowser:function(){MathJax.Hub.Browser.Select({MSIE:function(a){var b=MathJax.HTML.Element("span",{className:"mathjax"});MathJax.Hub.Insert(MathJax.Extension.mml2jax,{msieScriptBug:true,msieMathTagBug:(MathJax.HTML.Element("span",{innerHTML:"<math><mi>x</mi></math>"}).childNodes.length!==1),msieAttributeBug:(b.outerHTML.substr(12)!=='"')})}})}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@ if (document.getElementById && document.childNodes && document.createElement) {
if (!window.MathJax) {window.MathJax= {}} if (!window.MathJax) {window.MathJax= {}}
if (!MathJax.Hub) { // skip if already loaded if (!MathJax.Hub) { // skip if already loaded
MathJax.version = "1.1"; MathJax.version = "1.1.1";
/**********************************************************/ /**********************************************************/
@ -1178,7 +1178,8 @@ MathJax.Hub = {
// set to a Callback to wait for before continuing with the startup // set to a Callback to wait for before continuing with the startup
skipStartupTypeset: false, // set to true to skip PreProcess and Process during startup skipStartupTypeset: false, // set to true to skip PreProcess and Process during startup
"v1.0-compatible": true, // set to false to prevent loading of default configuration file "v1.0-compatible": true, // set to false to prevent loading of default configuration file
elements: [], // array of elements to process when none is given explicitly
preProcessors: [], // list of callbacks for preprocessing (initialized by extensions) preProcessors: [], // list of callbacks for preprocessing (initialized by extensions)
inputJax: {}, // mime-type mapped to input jax (by registration) inputJax: {}, // mime-type mapped to input jax (by registration)
outputJax: {order:{}}, // mime-type mapped to output jax list (by registration) outputJax: {order:{}}, // mime-type mapped to output jax list (by registration)
@ -1281,20 +1282,32 @@ MathJax.Hub = {
Typeset: function (element,callback) { Typeset: function (element,callback) {
if (!MathJax.isReady) return null; if (!MathJax.isReady) return null;
var ec = this.elementCallback(element,callback); var ec = this.elementCallback(element,callback);
return MathJax.Callback.Queue( var queue = MathJax.Callback.Queue();
["PreProcess",this,ec.element], for (var i = 0, m = ec.elements.length; i < m; i++) {
["Process",this,ec.element] if (ec.elements[i]) {
).Push(ec.callback); queue.Push(
["PreProcess",this,ec.elements[i]],
["Process",this,ec.elements[i]]
);
}
}
return queue.Push(ec.callback);
}, },
PreProcess: function (element,callback) { PreProcess: function (element,callback) {
var ec = this.elementCallback(element,callback); var ec = this.elementCallback(element,callback);
return MathJax.Callback.Queue( var queue = MathJax.Callback.Queue();
["Post",this.signal,"Begin PreProcess"], for (var i = 0, m = ec.elements.length; i < m; i++) {
["ExecuteHooks",MathJax.Callback, if (ec.elements[i]) {
(arguments.callee.disabled ? [] : this.config.preProcessors), ec.element, true], queue.Push(
["Post",this.signal,"End PreProcess"] ["Post",this.signal,["Begin PreProcess",ec.elements[i]]],
).Push(ec.callback); ["ExecuteHooks",MathJax.Callback,
(arguments.callee.disabled ? [] : this.config.preProcessors), ec.elements[i], true],
["Post",this.signal,["End PreProcess",ec.elements[i]]]
);
}
}
return queue.Push(ec.callback);
}, },
Process: function (element,callback) {return this.takeAction("Process",element,callback)}, Process: function (element,callback) {return this.takeAction("Process",element,callback)},
@ -1303,14 +1316,19 @@ MathJax.Hub = {
takeAction: function (action,element,callback) { takeAction: function (action,element,callback) {
var ec = this.elementCallback(element,callback); var ec = this.elementCallback(element,callback);
var scripts = []; // filled in by prepareScripts var queue = MathJax.Callback.Queue(["Clear",this.signal]);
return MathJax.Callback.Queue( for (var i = 0, m = ec.elements.length; i < m; i++) {
["Clear",this.signal], if (ec.elements[i]) {
["Post",this.signal,["Begin "+action,ec.element]], var scripts = []; // filled in by prepareScripts
["prepareScripts",this,action,ec.element,scripts], queue.Push(
["processScripts",this,scripts], ["Post",this.signal,["Begin "+action,ec.elements[i]]],
["Post",this.signal,["End "+action,ec.element]] ["prepareScripts",this,action,ec.elements[i],scripts],
).Push(ec.callback); ["processScripts",this,scripts],
["Post",this.signal,["End "+action,ec.elements[i]]]
);
}
}
return queue.Push(ec.callback);
}, },
scriptAction: { scriptAction: {
@ -1385,11 +1403,11 @@ MathJax.Hub = {
if (!start) {start = new Date().getTime()} if (!start) {start = new Date().getTime()}
var i = 0, script, prev; var i = 0, script, prev;
while (i < scripts.length) { while (i < scripts.length) {
script = scripts[i]; if (!script) continue; script = scripts[i]; if (!script) {i++; continue}
prev = script.previousSibling; prev = script.previousSibling;
if (prev && prev.className === "MathJax_Error") {prev.parentNode.removeChild(prev)} if (prev && prev.className === "MathJax_Error") {prev.parentNode.removeChild(prev)}
var type = script.type.replace(/ *;(.|\s)*/,""); var type = script.type.replace(/ *;(.|\s)*/,"");
if (!script.MathJax || script.MathJax.state === STATE.PROCESSED) continue; if (!script.MathJax || script.MathJax.state === STATE.PROCESSED) {i++; continue};
if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) { if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) {
this.checkScriptSiblings(script); this.checkScriptSiblings(script);
result = inputJax[type].Process(script); result = inputJax[type].Process(script);
@ -1444,12 +1462,15 @@ MathJax.Hub = {
elementCallback: function (element,callback) { elementCallback: function (element,callback) {
if (callback == null && (element instanceof Array || typeof element === 'function')) if (callback == null && (element instanceof Array || typeof element === 'function'))
{callback = element; element = document.body} {try {MathJax.Callback(element); callback = element; element = null} catch(e) {}}
else if (element == null) {element = document.body} if (element == null) {element = this.config.elements || []}
else if (typeof(element) === 'string') {element = document.getElementById(element)} if (!(element instanceof Array)) {element = [element]}
if (!element) {throw Error("No such element")} element = [].concat(element); // make a copy so the original isn't changed
for (var i = 0, m = element.length; i < m; i++)
{if (typeof(element[i]) === 'string') {element[i] = document.getElementById(element[i])}}
if (element.length == 0) {element.push(document.body)}
if (!callback) {callback = {}} if (!callback) {callback = {}}
return {element: element, callback: callback}; return {elements: element, callback: callback};
}, },
elementScripts: function (element) { elementScripts: function (element) {

View File

@ -174,6 +174,16 @@ MathJax.Hub.Config({
// //
skipStartupTypeset: false, skipStartupTypeset: false,
//
// A list of element ID's that are the ones to process for mathematics
// when any of the Hub typesetting calls (Typeset, Process, Update, etc)
// are called with no element specified. This lets you restrict the
// processing to particular containers rather than scanning the entire
// document for mathematics. If none are supplied, the entire document
// is processed.
//
elements: [],
//============================================================================ //============================================================================
// //
// These parameters control the tex2jax preprocessor (when you have included // These parameters control the tex2jax preprocessor (when you have included

View File

@ -31,12 +31,9 @@
*/ */
MathJax.Extension.jsMath2jax = { MathJax.Extension.jsMath2jax = {
version: "1.1", version: "1.1.1",
config: { config: {
element: null, // The ID of the element to be processed
// (defaults to full document)
preview: "TeX" // Set to "none" to prevent preview strings from being inserted preview: "TeX" // Set to "none" to prevent preview strings from being inserted
// or to an array that specifies an HTML snippet to use for // or to an array that specifies an HTML snippet to use for
// the preview. // the preview.
@ -52,7 +49,7 @@ MathJax.Extension.jsMath2jax = {
this.configured = true; this.configured = true;
} }
if (typeof(element) === "string") {element = document.getElementById(element)} if (typeof(element) === "string") {element = document.getElementById(element)}
if (!element) {element = this.config.element || document.body} if (!element) {element = document.body}
var span = element.getElementsByTagName("span"), i; var span = element.getElementsByTagName("span"), i;
for (i = span.length-1; i >= 0; i--) for (i = span.length-1; i >= 0; i--)
{if (String(span[i].className).match(/(^| )math( |$)/)) {this.ConvertMath(span[i],"")}} {if (String(span[i].className).match(/(^| )math( |$)/)) {this.ConvertMath(span[i],"")}}

View File

@ -24,11 +24,8 @@
*/ */
MathJax.Extension.mml2jax = { MathJax.Extension.mml2jax = {
version: "1.1", version: "1.1.1",
config: { config: {
element: null, // The ID of the element to be processed
// (defaults to full document)
preview: "alttext" // Use the <math> element's alttext as the preview: "alttext" // Use the <math> element's alttext as the
// preview. Set to "none" for no preview, // preview. Set to "none" for no preview,
// or set to an array specifying an HTML snippet // or set to an array specifying an HTML snippet
@ -45,7 +42,7 @@ MathJax.Extension.mml2jax = {
this.configured = true; this.configured = true;
} }
if (typeof(element) === "string") {element = document.getElementById(element)} if (typeof(element) === "string") {element = document.getElementById(element)}
if (!element) {element = this.config.element || document.body} if (!element) {element = document.body}
// //
// Handle all math tags with no namespaces // Handle all math tags with no namespaces
// //

View File

@ -24,11 +24,8 @@
*/ */
MathJax.Extension.tex2jax = { MathJax.Extension.tex2jax = {
version: "1.1", version: "1.1.1",
config: { config: {
element: null, // The ID of the element to be processed
// (defaults to full document)
inlineMath: [ // The start/stop pairs for in-line math inlineMath: [ // The start/stop pairs for in-line math
// ['$','$'], // (comment out any you don't want, or add your own, but // ['$','$'], // (comment out any you don't want, or add your own, but
['\\(','\\)'] // be sure that you don't have an extra comma at the end) ['\\(','\\)'] // be sure that you don't have an extra comma at the end)
@ -74,7 +71,7 @@ MathJax.Extension.tex2jax = {
this.configured = true; this.configured = true;
} }
if (typeof(element) === "string") {element = document.getElementById(element)} if (typeof(element) === "string") {element = document.getElementById(element)}
if (!element) {element = this.config.element || document.body} if (!element) {element = document.body}
this.createPatterns(); this.createPatterns();
this.scanElement(element,element.nextSibling); this.scanElement(element,element.nextSibling);
}, },