From efa443ce65eea523379d1f3d59f8681f8396c1d3 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Fri, 23 Jan 2015 12:45:26 -0500 Subject: [PATCH] Check for toCommonHTML first, and allow errors to propagate (restarts should restart, not be trapped here). Resolves issue #1018. --- unpacked/extensions/CHTML-preview.js | 29 +++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/unpacked/extensions/CHTML-preview.js b/unpacked/extensions/CHTML-preview.js index 4c23d7837..7f008647b 100644 --- a/unpacked/extensions/CHTML-preview.js +++ b/unpacked/extensions/CHTML-preview.js @@ -96,23 +96,18 @@ return this.postFilter(preview,data); }, postFilter: function (preview,data) { - try { - data.math.root.toCommonHTML(preview); - } catch (err) { - // - // Load the CommonHTML jax if it is not already loaded - // - if (!data.math.root.toCommonHTML) { - var queue = MathJax.Callback.Queue(); - queue.Push( - ["Require",MathJax.Ajax,"[MathJax]/jax/output/CommonHTML/config.js"], - ["Require",MathJax.Ajax,"[MathJax]/jax/output/CommonHTML/jax.js"] - ); - HUB.RestartAfter(queue.Push({})); - } - if (!err.restart) {throw err} // an actual error - return MathJax.Callback.After(["postFilter",this,preview,data],err.restart); + // + // Load the CommonHTML jax if it is not already loaded + // + if (!data.math.root.toCommonHTML) { + var queue = MathJax.Callback.Queue(); + queue.Push( + ["Require",MathJax.Ajax,"[MathJax]/jax/output/CommonHTML/config.js"], + ["Require",MathJax.Ajax,"[MathJax]/jax/output/CommonHTML/jax.js"] + ); + HUB.RestartAfter(queue.Push({})); } + data.math.root.toCommonHTML(preview); }, // @@ -135,6 +130,8 @@ CHTMLpreview.Register("AsciiMath"); HUB.Register.StartupHook("End Config",["Config",CHTMLpreview]); + + HUB.Startup.signal.Post("CHTML-preview Ready"); })(MathJax.Hub,MathJax.HTML);