From e533634f37137dde6635d5066b1e9376f0af1985 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Tue, 21 Apr 2015 17:34:48 -0400 Subject: [PATCH] Add a postInputHooks list so that we can attach global filters like the MathML semantic enhancement filter. --- unpacked/MathJax.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unpacked/MathJax.js b/unpacked/MathJax.js index bc274ff87..47e27390f 100644 --- a/unpacked/MathJax.js +++ b/unpacked/MathJax.js @@ -2172,13 +2172,15 @@ MathJax.Hub = { if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) { this.checkScriptSiblings(script); // remove preJax/postJax etc. var type = script.type.replace(/ *;(.|\s)*/,""); // the input jax type - jax = this.inputJax[type].Process(script,state); // run the input jax + var input = this.inputJax[type]; // the input jax itself + jax = input.Process(script,state); // run the input jax if (typeof jax === 'function') { // if a callback was returned if (jax.called) continue; // go back and call Process() again this.RestartAfter(jax); // wait for the callback } - jax.Attach(script,this.inputJax[type].id); // register the jax on the script + jax.Attach(script,input.id); // register the jax on the script this.saveScript(jax,state,script,STATE); // add script to state + this.postInputHooks.Execute(jax,input.id,script); // run global jax filters } else if (script.MathJax.state === STATE.OUTPUT) { this.saveScript(script.MathJax.elementJax,state,script,STATE); // add script to state } @@ -2198,6 +2200,7 @@ MathJax.Hub = { state.start = new Date().getTime(); state.i = state.j = 0; return null; }, + postInputHooks: MathJax.Callback.Hooks(true), // hooks to run after element jax is created saveScript: function (jax,state,script,STATE) { // // Check that output jax exists