Skip to content

Commit

Permalink
Resolves asciidoctor#100, Update MathJax to 2.6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Jan 31, 2016
1 parent 60e9450 commit 7e23927
Show file tree
Hide file tree
Showing 1,095 changed files with 102,858 additions and 4,071 deletions.
1 change: 1 addition & 0 deletions app/js/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ function appendMathJax() {
mathJaxJsScriptConfig.type = 'text/x-mathjax-config';
mathJaxJsScriptConfig.text =
'MathJax.Hub.Config({' +
' messageStyle: "none",' +
' tex2jax: {' +
' inlineMath: [["\\\\(", "\\\\)"]],' +
' displayMath: [["\\\\[", "\\\\]"]],' +
Expand Down
3 changes: 2 additions & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"js/vendor/asciidoctor-chart-block-macro.js",
"js/vendor/asciidoctor-emoji-inline-macro.js",
"fonts/fontawesome-webfont.woff2",
"vendor/MathJax/*"
"vendor/MathJax/*",
"vendor/fonts/*"
],
"permissions":[
"storage",
Expand Down
3,264 changes: 3,257 additions & 7 deletions app/vendor/MathJax/MathJax.js

Large diffs are not rendered by default.

57 changes: 10 additions & 47 deletions app/vendor/MathJax/config/Accessible.js

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions app/vendor/MathJax/config/MMLorHTML.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* /MathJax/config/MMLorHTML.js
*
* Copyright (c) 2009-2015 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* 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(c,g){var f="2.6.0";var a=MathJax.Hub.CombineConfig("MMLorHTML",{prefer:{MSIE:"MML",Firefox:"HTML",Opera:"HTML",Chrome:"HTML",Safari:"HTML",other:"HTML"}});var e={Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4};var b=(g.version==="0.0"||g.versionAtLeast(e[g]||0));var d=(g.isFirefox&&g.versionAtLeast("1.5"))||(g.isMSIE&&g.hasMathPlayer)||(g.isSafari&&g.versionAtLeast("5.0"))||(g.isOpera&&g.versionAtLeast("9.52"));c.Register.StartupHook("End Config",function(){var h=(a.prefer&&typeof(a.prefer)==="object"?a.prefer[MathJax.Hub.Browser]||a.prefer.other||"HTML":a.prefer);if(b||d){if(d&&(h==="MML"||!b)){if(MathJax.OutputJax.NativeMML){MathJax.OutputJax.NativeMML.Register("jax/mml")}else{c.config.jax.unshift("output/NativeMML")}c.Startup.signal.Post("NativeMML output selected")}else{if(MathJax.OutputJax["HTML-CSS"]){MathJax.OutputJax["HTML-CSS"].Register("jax/mml")}else{c.config.jax.unshift("output/HTML-CSS")}c.Startup.signal.Post("HTML-CSS output selected")}}else{c.PreProcess.disabled=true;c.prepareScripts.disabled=true;MathJax.Message.Set(["MathJaxNotSupported","Your browser does not support MathJax"],null,4000);c.Startup.signal.Post("MathJax not supported")}})})(MathJax.Hub,MathJax.Hub.Browser);MathJax.Ajax.loadComplete("[MathJax]/config/MMLorHTML.js");
63 changes: 12 additions & 51 deletions app/vendor/MathJax/config/TeX-MML-AM_HTMLorMML.js

Large diffs are not rendered by default.

76 changes: 68 additions & 8 deletions app/vendor/MathJax/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2009-2013 The MathJax Consortium
* Copyright (c) 2009-2015 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,15 +76,30 @@ MathJax.Hub.Config({
// A comma-separated list of input and output jax to initialize at startup.
// Their main code is loaded only when they are actually used, so it is not
// inefficient to include jax that may not actually be used on the page. These
// are found in the MathJax/jax directory.
// are found in the MathJax/jax directory. The choices include
//
jax: ["input/TeX","output/HTML-CSS"],
// input/TeX
// input/MathML
// input/AsciiMath
//
// output/HTML-CSS
// output/NativeMML
// output/SVG
//
// If you change the input jax, you may need to include the appropriate
// preprocessor in the extensions array below.
//
jax: ["input/TeX", "output/HTML-CSS"],

//
// A comma-separated list of extensions to load at startup. The default
// directory is MathJax/extensions.
//
// Example: extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
//
// You may wish to include "mml2jax.js" if you are using "input/MathML" in the
// jax array above, and "asciimath2jax.js" if you using "input/AsciiMath".
// Include "jsmath2jax.js" if you are converting from using jsMath to MathJax.
//
extensions: ["tex2jax.js"],

Expand Down Expand Up @@ -154,10 +169,12 @@ MathJax.Hub.Config({
// These two parameters control the alignment and shifting of displayed equations.
// The first can be "left", "center", or "right", and determines the alignment of
// displayed equations. When the alignment is not "center", the second determines
// an indentation from the left or right side for the displayed equations.
// an indentation from the left or right side for the displayed equations. When
// the alignment is "center", the indent allows you to shift the center to the right
// or left (negative is left).
//
displayAlign: "center",
displayIndent: "0em",
displayIndent: "0",

//
// Normally MathJax will perform its starup commands (loading of
Expand Down Expand Up @@ -195,7 +212,7 @@ MathJax.Hub.Config({
// reposition the browser to the #hash location from the page URL after
// typesetting for the page.
//
positionToHash: false,
positionToHash: true,

//
// These control whether to attach the MathJax contextual menu to the
Expand Down Expand Up @@ -228,7 +245,8 @@ MathJax.Hub.Config({
context: "MathJax", // or "Browser" for pass-through to browser menu
mpContext: false, // true means pass menu events to MathPlayer in IE
mpMouse: false, // true means pass mouse events to MathPlayer in IE
texHints: true // include class names for TeXAtom elements
texHints: true, // include class names for TeXAtom elements
semantics: false // add semantics tag with original form in MathML output
},

//
Expand Down Expand Up @@ -492,7 +510,7 @@ MathJax.Hub.Config({
//
// This is the amound of indentation (from right or left) for the tags.
//
TagIndent: ".8em",
TagIndent: "0.8em",

//
// This is the width to use for the multline environment
Expand Down Expand Up @@ -569,6 +587,22 @@ MathJax.Hub.Config({
// These parameters control the AsciiMath input jax.
//
AsciiMath: {
//
// Determines whether the unicode positions for phi and varphi are
// to be swapped or not. (Unicode originally had these reversed, and
// many fonts have them reversed as well.) When set to true, phi
// and varphi will correspond to the LaTeX macros of the same name.
//
fixphi: true,

//
// Determines whether the MathML should be marked so that the HTML-CSS
// and SVG output jax will use MathML spacing rules rather than TeX
// spacing rules. Since AsciiMath was designed for MathML output, the
// MathML rules are used by default.
//
useMathMLspacing: true,

//
// Determines whether limits are placed above and below operators,
// or next to them. (AsciiMath doesn't have separate in-line and
Expand Down Expand Up @@ -702,10 +736,25 @@ MathJax.Hub.Config({
EqnChunkFactor: 1.5,
EqnChunkDelay: 100,

//
// This option indicates whether MathJax should try to correct the
// x-height of equations to match the size of the surrounding text.
//
matchFontHeight: true,

//
// When true, MathJax will not measure the widths or heights of the
// subexpressions as it creates its output, but instead will rely on
// its internal calculautions based on teh bounding boxes of the
// characters it uses, and will only take measurements when it
// absolutely has to. Since measurements cause display reflows, they
// slows down MathJax considerably, so without them MathJax runs
// faster, but can produce slightly less accurate character placements,
// especially in width fractions or roots.
//
noReflows: true,


//
// These settings control automatic line breaking. It is off by
// default, so only explicit line breaks are performed (via
Expand Down Expand Up @@ -921,6 +970,17 @@ MathJax.Hub.Config({
width: "container"
},

//
// These are the styles used for merror elements in SVG output. Note
// that only a limited number of style attributes are supported by
// SVG, but you can at least change the colors and borders.
//
//
merrorStyle: {
fontSize:"90%", color:"#C00", background:"#FF8",
border: "1px solid #C00", padding:"3px"
},

//
// This allows you to define or modify the styles used to display
// various math elements created by MathJax.
Expand Down
2 changes: 1 addition & 1 deletion app/vendor/MathJax/config/local/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2009-2013 The MathJax Consortium
* Copyright (c) 2009-2015 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
151 changes: 151 additions & 0 deletions app/vendor/MathJax/extensions/AssistiveMML.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */

/*************************************************************
*
* MathJax/extensions/AssistiveMML.js
*
* Implements an extension that inserts hidden MathML into the
* page for screen readers or other asistive technology.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2015 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* 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 (AJAX,CALLBACK,HUB,HTML) {
var SETTINGS = HUB.config.menuSettings;

var AssistiveMML = MathJax.Extension["AssistiveMML"] = {
version: "2.6.0",

config: {
disabled: false,
styles: {
".MJX_Assistive_MathML": {
position:"absolute!important",
top: 0, left: 0,
clip: (HUB.Browser.isMSIE && (document.documentMode||0) < 8 ?
"rect(1px 1px 1px 1px)" : "rect(1px, 1px, 1px, 1px)"),
padding: "1px 0 0 0!important",
border: "0!important",
height: "1px!important",
width: "1px!important",
overflow: "hidden!important",
display:"block!important"
},
".MJX_Assistive_MathML.MJX_Assistive_MathML_Block": {
width: "100%!important"
}
}
},

Config: function () {
if (!this.config.disabled && SETTINGS.assistiveMML == null)
HUB.Config({menuSettings:{assistiveMML:true}});
AJAX.Styles(this.config.styles);
HUB.Register.MessageHook("End Math",function (msg) {
if (SETTINGS.assistiveMML) return AssistiveMML.AddAssistiveMathML(msg[1])
});
},

//
// This sets up a state object that lists the jax and index into the jax,
// and a dummy callback that is used to synchronizing with MathJax.
// It will be called when the jax are all processed, and that will
// let the MathJax queue continue (it will block until then).
//
AddAssistiveMathML: function (node) {
var state = {
jax: HUB.getAllJax(node), i: 0,
callback: MathJax.Callback({})
};
this.HandleMML(state);
return state.callback;
},

//
// This removes the data-mathml attribute and the assistive MathML from
// all the jax.
//
RemoveAssistiveMathML: function (node) {
var jax = HUB.getAllJax(node), frame;
for (var i = 0, m = jax.length; i < m; i++) {
frame = document.getElementById(jax[i].inputID+"-Frame");
if (frame && frame.getAttribute("data-mathml")) {
frame.removeAttribute("data-mathml");
if (frame.lastChild && frame.lastChild.className.match(/MJX_Assistive_MathML/))
frame.removeChild(frame.lastChild);
}
}
},

//
// For each jax in the state, look up the frame.
// If the jax doesn't use NativeMML and hasn't already been handled:
// Get the MathML for the jax, taking resets into account.
// Add a data-mathml attribute to the frame, and
// Create a span that is not visible on screen and put the MathML in it,
// and add it to the frame.
// When all the jax are processed, call the callback.
//
HandleMML: function (state) {
var m = state.jax.length, jax, mml, frame, span;
while (state.i < m) {
jax = state.jax[state.i];
frame = document.getElementById(jax.inputID+"-Frame");
if (jax.outputJax !== "NativeMML" && frame && !frame.getAttribute("data-mathml")) {
try {
mml = jax.root.toMathML("").replace(/\n */g,"").replace(/<!--.*?-->/g,"");
} catch (err) {
if (!err.restart) throw err; // an actual error
return MathJax.Callback.After(["HandleMML",this,state],err.restart);
}
frame.setAttribute("data-mathml",mml);
span = HTML.addElement(frame,"span",{
isMathJax: true,
className: "MJX_Assistive_MathML"
+ (jax.root.Get("display") === "block" ? " MJX_Assistive_MathML_Block" : "")
});
span.innerHTML = mml;
frame.style.position = "relative";
frame.setAttribute("role","presentation");
frame.firstChild.setAttribute("aria-hidden","true");
span.setAttribute("role","presentation");
}
state.i++;
}
state.callback();
}

};

HUB.Startup.signal.Post("AssistiveMML Ready");

})(MathJax.Ajax,MathJax.Callback,MathJax.Hub,MathJax.HTML);

//
// Make sure the toMathML extension is loaded before we signal
// the load complete for this extension. Then wait for the end
// of the user configuration before configuring this extension.
//
MathJax.Callback.Queue(
["Require",MathJax.Ajax,"[MathJax]/extensions/toMathML.js"],
["loadComplete",MathJax.Ajax,"[MathJax]/extensions/AssistiveMML.js"],
function () {
MathJax.Hub.Register.StartupHook("End Config",["Config",MathJax.Extension.AssistiveMML]);
}
);

30 changes: 30 additions & 0 deletions app/vendor/MathJax/extensions/CHTML-preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */

/*************************************************************
*
* MathJax/extensions/CHTML-preview.js
*
* Backward compatibility with old CHTML-preview extension.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2014-2015 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* 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.
*/

MathJax.Callback.Queue(
["Require",MathJax.Ajax,"[MathJax]/extensions/fast-preview.js"],
["loadComplete",MathJax.Ajax,"[MathJax]/extensions/CHTML-preview.js"]
);
Loading

0 comments on commit 7e23927

Please sign in to comment.