lib/gollum/frontend/public/javascript/MathJax/extensions/TeX/noErrors.js in gollum-1.1.1 vs lib/gollum/frontend/public/javascript/MathJax/extensions/TeX/noErrors.js in gollum-1.2.0

- old
+ new

@@ -1,169 +1,18 @@ -/************************************************************* - * - * MathJax/extensions/TeX/noErrors.js +/* + * ../SourceForge/trunk/mathjax/extensions/TeX/noErrors.js * - * Prevents the TeX error messages from being displayed and shows the - * original TeX code instead. You can configure whether the dollar signs - * are shown or not for in-line math, and whether to put all the TeX on - * one line or use multiple-lines. - * - * To configure this extension, use - * - * MathJax.Hub.Configure({ - * TeX: { - * noErrors: { - * inlineDelimiters: ["",""], // or ["$","$"] or ["\\(","\\)"] - * multiLine: true, // false for TeX on all one line - * style: { - * "font-family": "serif", - * "font-size": "80%", - * "color": "black", - * "border": "1px solid" - * // add any additional CSS styles that you want - * // (be sure there is no extra comma at the end of the last item) - * } - * } - * } - * }); - * - * Display-style math is always shown in multi-line format, and without - * delimiters, as it will already be set off in its own centered - * paragraph, like standard display mathematics. - * - * The default settings place the invalid TeX in a multi-line box with a - * black border. If you want it to look as though the TeX is just part of - * the paragraph, use + * Copyright (c) 2010 Design Science, Inc. * - * MathJax.Hub.Configure({ - * TeX: { - * noErrors: { - * inlineDelimiters: ["$","$"], // or ["",""] or ["\\(","\\)"] - * multiLine: false, - * style: { - * "font-size": "normal", - * "border": "" - * } - * } - * } - * }); - * - * You may also wish to set the font family, as the default is "serif" - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2009 Design Science, Inc. + * Part of the MathJax library. + * See http://www.mathjax.org for details. * - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ -(function () { - - // - // The configuration defaults, augmented by the user settings - // - MathJax.Extension["TeX/noErrors"] = { - config: MathJax.Hub.Insert({ - multiLine: true, - inlineDelimiters: ["",""], // or use ["$","$"] or ["\\(","\\)"] - style: { - "font-family": "serif", - "font-size": "80%", - "color": "black", - "border": "1px solid" - } - },((MathJax.Hub.config.TeX||{}).noErrors||{})) - }; - - var CONFIG = MathJax.Extension["TeX/noErrors"].config; - var NBSP = String.fromCharCode(0xA0); - - MathJax.Hub.Config({ - TeX: { - Augment: { - // - // Make error messages be the original TeX code - // Mark them as errors and multi-line or not, and for - // multi-line TeX, make spaces non-breakable (to get formatting right) - // - formatError: function (err,math,displaystyle,script) { - var delim = CONFIG.inlineDelimiters; - var multiLine = (displaystyle || CONFIG.multiLine); - if (!displaystyle) {math = delim[0] + math + delim[1]} - if (multiLine) {math = math.replace(/ /g,NBSP)} else {math = math.replace(/\n/g," ")} - return MathJax.ElementJax.mml.merror(math).With({isError:true, multiLine: multiLine}); - } - } - }, - - "HTML-CSS": { - styles: { - ".MathJax .merror": MathJax.Hub.Insert({ - "font-style": null, - "background-color": null, - "vertical-align": (MathJax.Hub.Browser.isMSIE && CONFIG.multiLine ? "-2px" : "") - },CONFIG.style) - } - } - }); +MathJax.Unpack([ + ['(function(){var c="1.0";','MathJax.Extension["TeX/noErrors','"]={version:c,config:','MathJax.Hub.','Insert({','multiLine',':true,','inlineDelimiters',':["",""],style:{"font-family":"serif","font-size":"80%","text-align":"left",color:"black",padding:"1px 3px",border:"1px solid"}},((',3,'config.TeX||{}).noErrors||{}))};var a=',1,'"].config;var ','b=String.fromCharCode(160);',3,'Config({TeX:{Augment:{formatError:function(f,e,g,d){var i=a.',7,';var h=(g||a.',5,');if(!g){e=i[0]+e+i[1]}if(h){e=e.replace(/ /g,b)}else{e=e.replace(/\\n/g," ")}return ','MathJax.ElementJax.mml','.merror','(e).With({isError',6,5,':h})}}},"','HTML-CSS','":{styles:{".','MathJax .merror','":',3,'Insert({"font-style":null,"background-color":null,"vertical-align":(',3,'Browser.isMSIE&&a.',5,'?"-2px":"")},a.style)}}})})();',3,'Register.StartupHook("',26,' Jax Ready",function(){var ','a=',20,';var b=MathJax.OutputJax["',26,'"];var c=a.math','.prototype.toHTML',';a.math','.Augment({toHTML:function(','d,e','){if(this.data[0]&&this.data[0].data[0]&&this.data[0].data[0].isError){return this.data[0].data[0].','toHTML','(d)}return c.call(this,d',',e)}});a',21,47,'j','){if(!this.isError){return ','a.mbase',45,'.call(this,','j)}j=this.HTMLcreateSpan(j);','if(this.',5,'){j','.style.display="inline-block','"}var l','=this.data[0].data[0].data.join("").split(/\\n/);for(var ','g=0,e=l.length;g<e;g++){b.addText(j,l[g]);if(g!==e-1){b.addElement(j,"br")}}var n=b.getHD(','j.parentNode','),d=b.getW(',68,');if(e>1){var k=(n.h+n.d)/2,h=b.TeX.x_height/2;var f=b.config.styles[".',28,'"]["font-size"];if(f&&f.match(/%/)){h*=parseInt(f)/100}',68,'.style.verticalAlign','=b.Em(n.d+(h-k));n.h=h+k;n.d=k-h}j.bbox={h:n.h,d:n.d,w:d,lw:0,rw:d};return j','}});MathJax.Hub.Startup.signal.Post("TeX noErrors Ready")});MathJax.','Hub.',37,'NativeMML',39,'b=',20,';var a=',1,12,'c=b.math','.prototype.toNativeMML',';b.math','.Augment({toNativeMML:function(','d',49,'toNativeMML',51,')}});b',21,90,'g',56,'b.mbase',88,59,'g)}g=','g.appendChild(document.','createElement("','span"));var h',66,'f=0,e=h.length;f<e;f++){',104,'createTextNode(h[f]));if(f!==e-1){',104,105,'br"))}}',61,5,'){g',64,'";if(e>1){g',75,'="middle"}}for(var j in a.style){if(a.style.hasOwnProperty(j)){var d=j.replace(/-./g,function(i){return i.charAt(1).toUpperCase()});g.style[d]=a.style[j]}}return g',77,'Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");'] +]); -})(); - -MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { - var MML = MathJax.ElementJax.mml; - var HTMLCSS = MathJax.OutputJax["HTML-CSS"]; - var CONFIG = MathJax.Extension["TeX/noErrors"].config; - - // - // Override math toHTML routine so that error messages - // don't have the clipping and other unneeded overhead - // - var math_toHTML = MML.math.prototype.toHTML; - MML.math.Augment({ - toHTML: function (span) { - if (this.data[0] && this.data[0].data[0] && this.data[0].data[0].isError) { - return this.data[0].data[0].toHTML(span); - } - return math_toHTML.call(this,span); - } - }); - - // - // Override merror toHTML routine so that it puts out the - // TeX code in an inlin-block with line breaks as in the original - // - MML.merror.Augment({ - toHTML: function (span) { - span = this.HTMLcreateSpan(span); - if (this.multiLine) {span.style.display = "inline-block"} - var text = this.data[0].data.join("").split(/\n/); - for (var i = 0, m = text.length; i < m; i++) { - HTMLCSS.addText(span,text[i]); - if (i !== m-1) {HTMLCSS.addElement(span,"br")} - } - var HD = HTMLCSS.getHD(span.parentNode), W = HTMLCSS.getW(span.parentNode); - if (m > 1) { - var H = (HD.h + HD.d)/2, x = HTMLCSS.TeX.x_height/2; - var scale = HTMLCSS.config.styles[".MathJax .merror"]["font-size"]; - if (scale && scale.match(/%/)) {x *= parseInt(scale)/100} - span.parentNode.style.verticalAlign = HTMLCSS.Em(HD.d+(x-H)); - HD.h = x + H; HD.d = H - x; - } - span.bbox = {h: HD.h, d: HD.d, w: W, lw: 0, rw: W}; - return span; - } - }); - - MathJax.Hub.Startup.signal.Post("TeX noErrors Ready"); -}); - -MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noErrors.js");