www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8ebcd614c3049362c3c08b5f99a0f9f306602021
parent f0c0c6386ef298a42ec433d390300a0f023421fc
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Sat, 16 Aug 2014 12:59:16 -0400

Properly handle restarts within the creation of the previews

Diffstat:
Munpacked/extensions/CHTML-preview.js | 27+++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/unpacked/extensions/CHTML-preview.js b/unpacked/extensions/CHTML-preview.js @@ -36,25 +36,16 @@ // after the previews have been created // config: HUB.CombineConfig("CHTML-preview",{ - EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 100 + EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 150 }), // // Ajust the chunking of the output jax // Config: function () { - var config = this.config; HUB.Config({ - "HTML-CSS": { - EqnChunk: config.EqnChunk, - EqnChunkFactor: config.EqnChunkFactor, - EqnChunkDelay: config.EqnChunkDelay - }, - "SVG": { - EqnChunk: config.EqnChunk, - EqnChunkFactor: config.EqnChunkFactor, - EqnChunkDelay: config.EqnChunkDelay - } + "HTML-CSS": this.config, + "SVG": this.config }); }, @@ -69,9 +60,17 @@ data.script.parentNode.insertBefore(preview,data.script); } preview.innerHTML = ""; - data.math.root.toCommonHTML(preview); + return this.postFilter(preview,data); return data; }, + postFilter: function (preview,data) { + try { + data.math.root.toCommonHTML(preview); + } catch (err) { + if (!err.restart) {throw err} // an actual error + return MathJax.Callback.After(["postFilter",this,preview,data],err.restart); + } + }, // // Hook into the inut jax postFilter to create the previews as @@ -87,7 +86,7 @@ "[MathJax]/jax/output/CommonHTML/config.js", "[MathJax]/jax/output/CommonHTML/jax.js" ); - jax.postfilterHooks.Add(["Preview",MathJax.Extension["CHTML-preview"]]); + jax.postfilterHooks.Add(["Preview",MathJax.Extension["CHTML-preview"]],50); }); } }