Make constant messages be translated when they are used rather than when they are defined. Rework About box, add menu ID's. Make TeX.Error() and MathML.Error() handle localization. Break up Fred's French data into separate files. Make localization data load on demand. Other miscellaneous updates.

This commit is contained in:
Davide P. Cervone 2013-04-03 17:24:14 -04:00
parent 503f997064
commit 660f38959a
32 changed files with 1474 additions and 1235 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,8 @@ MathJax.Hub.Config({
mpMouse: true mpMouse: true
}, },
errorSettings: { errorSettings: {
// Localization: should be updated when the language is changed message: ["[Math Error]"],
message: ["["+MathJax.Localization._("MathError", "Math Error")+"]"] messageId: "MathErrorHTML"
} }
}); });

View File

@ -24,8 +24,8 @@ MathJax.Hub.Config({
mpMouse: true mpMouse: true
}, },
errorSettings: { errorSettings: {
// Localization: should be updated when the language is changed message: ["[Math Error]"],
message: ["["+MathJax.Localization._("MathError", "Math Error")+"]"] messageId: "MathErrorHTML"
} }
}); });

View File

@ -98,9 +98,9 @@
HUB.PreProcess.disabled = true; HUB.PreProcess.disabled = true;
HUB.prepareScripts.disabled = true; HUB.prepareScripts.disabled = true;
MathJax.Message.Set( MathJax.Message.Set(
MathJax.Localization._(["Message", MathJaxNotSupported], ["MathJaxNotSupported","Your browser does not support MathJax"],
"Your browser does not support MathJax"), null,4000
null,4000); );
HUB.Startup.signal.Post("MathJax not supported"); HUB.Startup.signal.Post("MathJax not supported");
} }
}); });

View File

@ -236,10 +236,8 @@ MathJax.Hub.Config({
// jax that prevents it from operating properly). // jax that prevents it from operating properly).
// //
errorSettings: { errorSettings: {
// Localization: message: ["[Math Processing Error]"], // HTML snippet structure for message to use
// TODO messageId: "MathProcessingError", // ID of snippet for localization
// should be updated when the language is changed
message: ["[MathProcessingError]"], // HTML snippet structure for message to use
style: {color: "#CC0000", "font-style":"italic"} // style for message style: {color: "#CC0000", "font-style":"italic"} // style for message
}, },

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/FontWarnings.js * MathJax/extensions/FontWarnings.js
@ -85,11 +86,11 @@
*/ */
(function (HUB,HTML) { (function (HUB,HTML) {
var VERSION = "2.1"; var VERSION = "2.1.1";
var _ = function (id) { var _ = function (id) {
return MathJax.Localization._.apply(MathJax.Localization, return MathJax.Localization._.apply(MathJax.Localization,
[ ["FontWarnings",id] ].concat([].slice.call(arguments,1)) [["FontWarnings",id]].concat([].slice.call(arguments,1))
); );
} }
@ -194,7 +195,7 @@
], ],
fonts: _("fonts", fonts: _("fonts",
"%1 MathJax can use either the %2 or the % "+ "%1 MathJax can use either the %2 or the %3 "+
". Download and install either one to improve your MathJax experience.", ". Download and install either one to improve your MathJax experience.",
[["p"]], [["p"]],
[["a",{href:"http://www.stixfonts.org/",target:"_blank"}, [["a",{href:"http://www.stixfonts.org/",target:"_blank"},

View File

@ -22,8 +22,8 @@
* limitations under the License. * limitations under the License.
*/ */
(function (HUB,HTML,AJAX,CALLBACK,OUTPUT,INPUT) { (function (HUB,HTML,AJAX,CALLBACK,LOCALE,OUTPUT,INPUT) {
var VERSION = "2.1"; var VERSION = "2.1.1";
var EXTENSION = MathJax.Extension; var EXTENSION = MathJax.Extension;
var ME = EXTENSION.MathEvents = {version: VERSION}; var ME = EXTENSION.MathEvents = {version: VERSION};
@ -141,33 +141,46 @@
} }
// //
// If the menu code is loaded, post the menu // If the menu code is loaded,
// Otherwse lad the menu code and try again // Check if localization needs loading;
// If not, post the menu, and return.
// Otherwise wait for the localization to load
// Otherwse load the menu code.
// Try again after the file is loaded.
// //
var MENU = MathJax.Menu; var MENU = MathJax.Menu; var load, fn;
if (MENU) { if (MENU) {
MENU.jax = jax; if (MENU.loadingDomain) {return EVENT.False(event)}
var source = MENU.menu.Find("Show Math As").menu; load = LOCALE.loadDomain("MathMenu");
source.items[1].name = (INPUT[jax.inputJax].sourceMenuTitle||"Original Form"); if (!load) {
source.items[0].hidden = (jax.inputJax === "Error"); // hide MathML choice for error messages MENU.jax = jax;
var MathPlayer = MENU.menu.Find("Math Settings","MathPlayer"); var source = MENU.menu.Find("Show Math As").menu;
MathPlayer.hidden = !(jax.outputJax === "NativeMML" && HUB.Browser.hasMathPlayer); source.items[1].name = INPUT[jax.inputJax].sourceMenuTitle;
return MENU.menu.Post(event); source.items[0].hidden = (jax.inputJax === "Error"); // hide MathML choice for error messages
} else { var MathPlayer = MENU.menu.Find("Math Settings","MathPlayer");
if (!AJAX.loadingMathMenu) { MathPlayer.hidden = !(jax.outputJax === "NativeMML" && HUB.Browser.hasMathPlayer);
AJAX.loadingMathMenu = true; return MENU.menu.Post(event);
var ev = { }
pageX:event.pageX, pageY:event.pageY, MENU.loadingDomain = true;
clientX:event.clientX, clientY:event.clientY fn = function () {delete MENU.loadingDomain};
}; } else {
CALLBACK.Queue( if (AJAX.loadingMathMenu) {return EVENT.False(event)}
AJAX.Require("[MathJax]/extensions/MathMenu.js"), AJAX.loadingMathMenu = true;
function () {delete AJAX.loadingMathMenu; if (!MathJax.Menu) {MathJax.Menu = {}}}, load = AJAX.Require("[MathJax]/extensions/MathMenu.js");
["ContextMenu",this,ev,math,force] // call this function again fn = function () {
); delete AJAX.loadingMathMenu;
if (!MathJax.Menu) {MathJax.Menu = {}}
} }
return EVENT.False(event);
} }
var ev = {
pageX:event.pageX, pageY:event.pageY,
clientX:event.clientX, clientY:event.clientY
};
CALLBACK.Queue(
load, fn, // load the file and delete the marker when done
["ContextMenu",EVENT,ev,math,force] // call this function again
);
return EVENT.False(event);
}, },
// //
@ -530,4 +543,5 @@
["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"] ["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"]
); );
})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,MathJax.OutputJax,MathJax.InputJax); })(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,
MathJax.Localization,MathJax.OutputJax,MathJax.InputJax);

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/MathMenu.js * MathJax/extensions/MathMenu.js
@ -26,7 +27,7 @@
*/ */
(function (HUB,HTML,AJAX,CALLBACK,OUTPUT) { (function (HUB,HTML,AJAX,CALLBACK,OUTPUT) {
var VERSION = "2.1"; var VERSION = "2.1.1";
var SIGNAL = MathJax.Callback.Signal("menu") // signal for menu events var SIGNAL = MathJax.Callback.Signal("menu") // signal for menu events
@ -38,7 +39,7 @@
var _ = function (id) { var _ = function (id) {
return MathJax.Localization._.apply( return MathJax.Localization._.apply(
MathJax.Localization, MathJax.Localization,
[ ["Menu", id] ].concat([].slice.call(arguments,1)) [["MathMenu",id]].concat([].slice.call(arguments,1))
); );
}; };
@ -184,7 +185,6 @@
*/ */
Post: function (event,parent) { Post: function (event,parent) {
if (!event) {event = window.event}; if (!event) {event = window.event};
var title = (!this.title ? null : [["div",{className: "MathJax_MenuTitle"},[this.title]]]);
var div = document.getElementById("MathJax_MenuFrame"); var div = document.getElementById("MathJax_MenuFrame");
if (!div) { if (!div) {
div = MENU.Background(this); div = MENU.Background(this);
@ -196,7 +196,8 @@
onmouseup: MENU.Mouseup, ondblclick: FALSE, onmouseup: MENU.Mouseup, ondblclick: FALSE,
ondragstart: FALSE, onselectstart: FALSE, oncontextmenu: FALSE, ondragstart: FALSE, onselectstart: FALSE, oncontextmenu: FALSE,
menuItem: this, className: "MathJax_Menu" menuItem: this, className: "MathJax_Menu"
},title); });
MathJax.Localization.setCSS(menu);
for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)} for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)}
if (MENU.isMobile) { if (MENU.isMobile) {
@ -260,16 +261,17 @@
}, },
/* /*
* Find a named item in a menu (or submenu). * Find an item in a menu (or submenu) by name (Find) or ID (FindID).
* A list of names means descend into submenus. * A list of names or IDs means descend into submenus.
*/ */
Find: function (name) { Find: function (name) {return this.FindN(1,name,[].slice.call(arguments,1))},
var names = [].slice.call(arguments,1); FindId: function (name) {return this.FindN(0,name,[].slice.call(arguments,1))},
FindN: function (n,name,names) {
for (var i = 0, m = this.items.length; i < m; i++) { for (var i = 0, m = this.items.length; i < m; i++) {
if (this.items[i].name === name) { if (this.items[i].name[n] === name) {
if (names.length) { if (names.length) {
if (!this.items[i].menu) {return null} if (!this.items[i].menu) {return null}
return this.items[i].menu.Find.apply(this.items[i].menu,names); return this.items[i].menu.FindN(n,names[0],names.slice(1));
} }
return this.items[i]; return this.items[i];
} }
@ -280,9 +282,11 @@
/* /*
* Find the index of a menu item (so we can insert before or after it) * Find the index of a menu item (so we can insert before or after it)
*/ */
IndexOf: function (name) { IndexOf: function (name) {return this.IndexOfN(1,name)},
IndexOfId: function (name) {return this.IndexOfN(0,name)},
IndexOfN: function (n,name) {
for (var i = 0, m = this.items.length; i < m; i++) for (var i = 0, m = this.items.length; i < m; i++)
{if (this.items[i].name === name) {return i}} {if (this.items[i].name[n] === name) {return i}}
return null; return null;
} }
@ -370,7 +374,7 @@
* The menu item root subclass * The menu item root subclass
*/ */
var ITEM = MENU.ITEM = MathJax.Object.Subclass({ var ITEM = MENU.ITEM = MathJax.Object.Subclass({
name: "", // the menu item's label name: "", // the menu item's label as [id,label] pair
Create: function (menu) { Create: function (menu) {
if (!this.hidden) { if (!this.hidden) {
@ -385,6 +389,7 @@
HTML.addElement(menu,"div",def,this.Label(def,menu)); HTML.addElement(menu,"div",def,this.Label(def,menu));
} }
}, },
Name: function () {return _(this.name[0],this.name[1])},
Mouseover: function (event,menu) { Mouseover: function (event,menu) {
if (!this.disabled) {this.Activate(menu)} if (!this.disabled) {this.Activate(menu)}
@ -442,11 +447,12 @@
action: function () {}, action: function () {},
Init: function (name,action,def) { Init: function (name,action,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.action = action; this.name = name; this.action = action;
this.With(def); this.With(def);
}, },
Label: function (def,menu) {return [this.name]}, Label: function (def,menu) {return [this.Name()]},
Mouseup: function (event,menu) { Mouseup: function (event,menu) {
if (!this.disabled) { if (!this.disabled) {
this.Remove(event,menu); this.Remove(event,menu);
@ -466,13 +472,14 @@
marker: (isPC && !HUB.Browser.isSafari ? "\u25B6" : "\u25B8"), // the menu arrow marker: (isPC && !HUB.Browser.isSafari ? "\u25B6" : "\u25B8"), // the menu arrow
Init: function (name,def) { Init: function (name,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; var i = 1; this.name = name; var i = 1;
if (!(def instanceof MENU.ITEM)) {this.With(def), i++} if (!(def instanceof MENU.ITEM)) {this.With(def), i++}
this.menu = MENU.apply(MENU,[].slice.call(arguments,i)); this.menu = MENU.apply(MENU,[].slice.call(arguments,i));
}, },
Label: function (def,menu) { Label: function (def,menu) {
this.menu.posted = false; this.menu.posted = false;
return [this.name+" ",["span",{className:"MathJax_MenuArrow"},[this.marker]]]; return [this.Name()+" ",["span",{className:"MathJax_MenuArrow"},[this.marker]]];
}, },
Timer: function (event,menu) { Timer: function (event,menu) {
if (this.timer) {clearTimeout(this.timer)} if (this.timer) {clearTimeout(this.timer)}
@ -515,13 +522,14 @@
marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark
Init: function (name,variable,def) { Init: function (name,variable,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.variable = variable; this.With(def); this.name = name; this.variable = variable; this.With(def);
if (this.value == null) {this.value = this.name} if (this.value == null) {this.value = this.name[0]}
}, },
Label: function (def,menu) { Label: function (def,menu) {
var span = {className:"MathJax_MenuRadioCheck"}; var span = {className:"MathJax_MenuRadioCheck"};
if (CONFIG.settings[this.variable] !== this.value) {span = {style:{display:"none"}}} if (CONFIG.settings[this.variable] !== this.value) {span = {style:{display:"none"}}}
return [["span",span,[this.marker]]," "+this.name]; return [["span",span,[this.marker]]," "+this.Name()];
}, },
Mouseup: function (event,menu) { Mouseup: function (event,menu) {
if (!this.disabled) { if (!this.disabled) {
@ -551,12 +559,13 @@
marker: "\u2713", // the checkmark marker: "\u2713", // the checkmark
Init: function (name,variable,def) { Init: function (name,variable,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.variable = variable; this.With(def); this.name = name; this.variable = variable; this.With(def);
}, },
Label: function (def,menu) { Label: function (def,menu) {
var span = {className:"MathJax_MenuCheck"}; var span = {className:"MathJax_MenuCheck"};
if (!CONFIG.settings[this.variable]) {span = {style:{display:"none"}}} if (!CONFIG.settings[this.variable]) {span = {style:{display:"none"}}}
return [["span",span,[this.marker]]," "+this.name]; return [["span",span,[this.marker]]," "+this.Name()];
}, },
Mouseup: function (event,menu) { Mouseup: function (event,menu) {
if (!this.disabled) { if (!this.disabled) {
@ -576,11 +585,14 @@
* A menu item that is a label * A menu item that is a label
*/ */
MENU.ITEM.LABEL = MENU.ITEM.Subclass({ MENU.ITEM.LABEL = MENU.ITEM.Subclass({
Init: function (name,def) {this.name = name; this.With(def)}, Init: function (name,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.With(def);
},
Label: function (def,menu) { Label: function (def,menu) {
delete def.onmouseover, delete def.onmouseout; delete def.onmousedown; delete def.onmouseover, delete def.onmouseout; delete def.onmousedown;
def.className += " MathJax_MenuLabel"; def.className += " MathJax_MenuLabel";
return [this.name]; return [this.Name()];
} }
}); });
@ -604,36 +616,33 @@
*/ */
// Localization: need to be reorganized. currently, there are concatenation // Localization: need to be reorganized. currently, there are concatenation
// of HTMLCSS.fontInUse and English strings based on the values of // of HTMLCSS.fontInUse and English strings based on the values of
// HTMLCSS.webFonts and HTMLCSS.imgFonts, HTMLCSS.allowWebFonts etc Update // HTMLCSS.webFonts and HTMLCSS.imgFonts, HTMLCSS.allowWebFonts etc
// MENU.About.GetJax too.
MENU.About = function () { MENU.About = function () {
var HTMLCSS = OUTPUT["HTML-CSS"] || {fontInUse: ""}; var HTMLCSS = OUTPUT["HTML-CSS"] || {};
var local = (HTMLCSS.webFonts ? "" : "local "), web = (HTMLCSS.webFonts ? " web" : ""); var font =
var font = (HTMLCSS.imgFonts ? "Image" : local+HTMLCSS.fontInUse+web) + " fonts"; (HTMLCSS.imgFonts ? "image" :
if (font === "local fonts" && OUTPUT.SVG) {font = "web SVG fonts"} (HTMLCSS.fontInUse ?
(HTMLCSS.webFonts ? "web" : "local")+" "+HTMLCSS.fontInUse :
(OUTPUT.SVG ? "web SVG" : "generic")) ) + " fonts";
var format = (!HTMLCSS.webFonts || HTMLCSS.imgFonts ? null :
HTMLCSS.allowWebFonts.replace(/otf/,"woff or otf") + " fonts");
var jax = ["MathJax.js v"+MathJax.fileversion,["br"]]; var jax = ["MathJax.js v"+MathJax.fileversion,["br"]];
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]); jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);
MENU.About.GetJax(jax,MathJax.InputJax,"Input Jax"); MENU.About.GetJax(jax,MathJax.InputJax,_("InputJax","Input Jax"));
MENU.About.GetJax(jax,MathJax.OutputJax,"Output Jax"); MENU.About.GetJax(jax,MathJax.OutputJax,_("OutputJax","Output Jax"));
MENU.About.GetJax(jax,MathJax.ElementJax,"Element Jax"); MENU.About.GetJax(jax,MathJax.ElementJax,_("ElementJax","Element Jax"));
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]); jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);
MENU.About.GetJax(jax,MathJax.Extension,"Extension",true); MENU.About.GetJax(jax,MathJax.Extension,_("Extension","Extension"),true);
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[ jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[
HUB.Browser + " v"+HUB.Browser.version + HUB.Browser + " v"+HUB.Browser.version + (format ?
(HTMLCSS.webFonts && !HTMLCSS.imgFonts ? " \u2014 " + " \u2014 " + _(format.replace(/ /g,""),format) : "")
HTMLCSS.allowWebFonts.replace(/otf/,"woff or otf") + " fonts" : "")
]]); ]]);
// Localization:
// - decide HTML snippet format
// - how do we ensure it is updated when the language is changed?
MENU.About.div = MENU.Background(MENU.About); MENU.About.div = MENU.Background(MENU.About);
var about = HTML.addElement(MENU.About.div,"div",{ var about = HTML.addElement(MENU.About.div,"div",{
id: "MathJax_About" id: "MathJax_About"
}, },[
_("AboutBox", "%1 using %2", ["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],
[["b",{style:{fontSize:"120%"}},["MathJax"]], _(font.replace(/ /g,""),"using "+font),["br"],["br"],
" v"+MathJax.version,["br"]],
[font,["br"],["br"],
["span",{style:{ ["span",{style:{
display:"inline-block", "text-align":"left", "font-size":"80%", display:"inline-block", "text-align":"left", "font-size":"80%",
"max-height":"20em", overflow:"auto", "max-height":"20em", overflow:"auto",
@ -644,8 +653,9 @@
src: CONFIG.closeImg, src: CONFIG.closeImg,
style: {width:"21px", height:"21px", position:"absolute", top:".2em", right:".2em"}, style: {width:"21px", height:"21px", position:"absolute", top:".2em", right:".2em"},
onclick: MENU.About.Remove onclick: MENU.About.Remove
}]]) }]
); ]);
MathJax.Localization.setCSS(about);
var doc = (document.documentElement||{}); var doc = (document.documentElement||{});
var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0; var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0;
if (MENU.prototype.msieAboutBug) { if (MENU.prototype.msieAboutBug) {
@ -709,7 +719,7 @@
} }
} else { } else {
if (MENU.jax.originalText == null) { if (MENU.jax.originalText == null) {
alert(_("NoOriginalForm", "No original form available")); alert(_("NoOriginalForm","No original form available"));
return; return;
} }
MENU.ShowSource.Text(MENU.jax.originalText,event); MENU.ShowSource.Text(MENU.jax.originalText,event);
@ -727,12 +737,12 @@
var w = MENU.ShowSource.Window(event); delete MENU.ShowSource.w; var w = MENU.ShowSource.Window(event); delete MENU.ShowSource.w;
text = text.replace(/^\s*/,"").replace(/\s*$/,""); text = text.replace(/^\s*/,"").replace(/\s*$/,"");
text = text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); text = text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var title = _("EqSource", "MathJax Equation Source"); var title = _("EqSource","MathJax Equation Source");
if (MENU.isMobile) { if (MENU.isMobile) {
w.document.open(); w.document.open();
w.document.write("<html><head><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>"+title+"</title></head><body style='font-size:85%'>"); w.document.write("<html><head><meta name='viewport' content='width=device-width, initial-scale=1.0' /><title>"+title+"</title></head><body style='font-size:85%'>");
w.document.write("<pre>"+text+"</pre>"); w.document.write("<pre>"+text+"</pre>");
w.document.write("<hr><input type='button' value='"+_("Close", "Close")+"' onclick='window.close()' />"); w.document.write("<hr><input type='button' value='"+_("Close","Close")+"' onclick='window.close()' />");
w.document.write("</body></html>"); w.document.write("</body></html>");
w.document.close(); w.document.close();
} else { } else {
@ -774,7 +784,7 @@
MENU.cookie.scale = scale; MENU.cookie.scale = scale;
MENU.saveCookie(); HUB.Reprocess(); MENU.saveCookie(); HUB.Reprocess();
} }
} else {alert(_("NonZeroScale", "The scale should not be zero"))} } else {alert(_("NonZeroScale","The scale should not be zero"))}
} else {alert(_("PercentScale", } else {alert(_("PercentScale",
"The scale should be a percentage (e.g., 120%%)"))} "The scale should be a percentage (e.g., 120%%)"))}
} }
@ -800,7 +810,8 @@
switch (CONFIG.settings.renderer) { switch (CONFIG.settings.renderer) {
case "NativeMML": case "NativeMML":
if (!CONFIG.settings.warnedMML) { if (!CONFIG.settings.warnedMML) {
if (BROWSER.isChrome || (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0"))) {message = MESSAGE.MML.WebKit} if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit}
else if (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0")) {message = MESSAGE.MML.WebKit}
else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}} else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}}
else {message = MESSAGE.MML[BROWSER]} else {message = MESSAGE.MML[BROWSER]}
warned = "warnedMML"; warned = "warnedMML";
@ -814,7 +825,7 @@
break; break;
} }
if (message) { if (message) {
// Localization: concatenation, new line message = _(message[0],message[1]);
message += "\n\n"; message += "\n\n";
message += _("SwitchAnyway", message += _("SwitchAnyway",
"Switch the renderer anyway?\n\n" + "Switch the renderer anyway?\n\n" +
@ -831,36 +842,34 @@
}; };
MENU.Renderer.Messages = { MENU.Renderer.Messages = {
MML: { MML: {
// Localization: should be updated when the language is changed WebKit: ["WebkitNativeMMLWarning",
// concatenation
WebKit: _("WebkitNativeMMLWarning",
"Your browser doesn't seem to support MathML natively, " + "Your browser doesn't seem to support MathML natively, " +
"so switching to MathML output may cause the mathematics " + "so switching to MathML output may cause the mathematics " +
"on the page to become unreadable."), "on the page to become unreadable."],
MSIE: _("MSIENativeMMLWarning", MSIE: ["MSIENativeMMLWarning",
"Internet Explorer requires the MathPlayer plugin " + "Internet Explorer requires the MathPlayer plugin " +
"in order to process MathML output."), "in order to process MathML output."],
Opera: _("OperaNativeMMLWarning", Opera: ["OperaNativeMMLWarning",
"Opera's support for MathML is limited, so switching to " + "Opera's support for MathML is limited, so switching to " +
"MathML output may cause some expressions to render poorly."), "MathML output may cause some expressions to render poorly."],
Safari: _("SafariNativeMMLWarning", Safari: ["SafariNativeMMLWarning",
"Your browser's native MathML does not implement all the features " + "Your browser's native MathML does not implement all the features " +
"used by MathJax, so some expressions may not render properly."), "used by MathJax, so some expressions may not render properly."],
Firefox: _("FirefoxNativeMMLWarning", Firefox: ["FirefoxNativeMMLWarning",
"Your browser's native MathML does not implement all the features " + "Your browser's native MathML does not implement all the features " +
"used by MathJax, so some expressions may not render properly.") "used by MathJax, so some expressions may not render properly."]
}, },
SVG: { SVG: {
MSIE: _("MSIESVGWarning", MSIE: ["MSIESVGWarning",
"SVG is not implemented in Internet Explorer prior to " + "SVG is not implemented in Internet Explorer prior to " +
"IE9, or when the browser is emulating IE8 or below. " + "IE9, or when the browser is emulating IE8 or below. " +
"Switching to SVG output will cause the mathemtics to " + "Switching to SVG output will cause the mathemtics to " +
"not display properly.") "not display properly."]
} }
}; };
@ -879,7 +888,7 @@
var discoverable = CONFIG.settings.discoverable, var discoverable = CONFIG.settings.discoverable,
MESSAGE = MENU.MPEvents.Messages; MESSAGE = MENU.MPEvents.Messages;
if (!isIE9) { if (!isIE9) {
if (CONFIG.settings.mpMouse && !confirm(MESSAGE.IE8warning)) { if (CONFIG.settings.mpMouse && !confirm(_.apply(_,MESSAGE.IE8warning))) {
delete MENU.cookie.mpContext; delete CONFIG.settings.mpContext; delete MENU.cookie.mpContext; delete CONFIG.settings.mpContext;
delete MENU.cookie.mpMouse; delete CONFIG.settings.mpMouse; delete MENU.cookie.mpMouse; delete CONFIG.settings.mpMouse;
MENU.saveCookie(); MENU.saveCookie();
@ -889,23 +898,20 @@
MENU.cookie.mpContext = MENU.cookie.mpMouse = CONFIG.settings.mpMouse; MENU.cookie.mpContext = MENU.cookie.mpMouse = CONFIG.settings.mpMouse;
MENU.saveCookie(); MENU.saveCookie();
MathJax.Hub.Queue(["Rerender",MathJax.Hub]) MathJax.Hub.Queue(["Rerender",MathJax.Hub])
} else if (!discoverable && item.name === "Menu Events" && CONFIG.settings.mpContext) { } else if (!discoverable && item.name[0] === "Menu Events" && CONFIG.settings.mpContext) {
alert(MESSAGE.IE9warning); alert(_.apply(_,MESSAGE.IE9warning));
} }
}; };
// Localization: should be updated when the language is changed
// concatenation
MENU.MPEvents.Messages = { MENU.MPEvents.Messages = {
IE8warning: IE8warning: ["IE8warning",
_("IE8warning",
"This will disable the MathJax menu and zoom features, " + "This will disable the MathJax menu and zoom features, " +
"but you can Alt-Click on an expression to obtain the MathJax " + "but you can Alt-Click on an expression to obtain the MathJax " +
"menu instead.\n\nReally change the MathPlayer settings?"), "menu instead.\n\nReally change the MathPlayer settings?"],
IE9warning: IE9warning: ["IE9warning",
_("IE9warning",
"The MathJax contextual menu will be disabled, but you can " + "The MathJax contextual menu will be disabled, but you can " +
"Alt-Click on an expression to obtain the MathJax menu instead.") "Alt-Click on an expression to obtain the MathJax menu instead."]
}; };
/*************************************************************/ /*************************************************************/
@ -954,27 +960,27 @@
*/ */
// Localization: items used as key, should be refactored. // Localization: items used as key, should be refactored.
MENU.menu = MENU( MENU.menu = MENU(
ITEM.SUBMENU("Show Math As", ITEM.SUBMENU(["Show","Show Math As"],
ITEM.COMMAND("MathML Code", MENU.ShowSource, {nativeTouch: true, format: "MathML"}), ITEM.COMMAND(["MathMLcode","MathML Code"], MENU.ShowSource, {nativeTouch: true, format: "MathML"}),
ITEM.COMMAND("Original Form", MENU.ShowSource, {nativeTouch: true}), ITEM.COMMAND(["Original","Original Form"], MENU.ShowSource, {nativeTouch: true}),
ITEM.RULE(), ITEM.RULE(),
ITEM.CHECKBOX("Show TeX hints in MathML", "texHints") ITEM.CHECKBOX(["texHints","Show TeX hints in MathML"], "texHints")
), ),
ITEM.RULE(), ITEM.RULE(),
ITEM.SUBMENU("Math Settings", ITEM.SUBMENU(["Settings","Math Settings"],
ITEM.SUBMENU("Zoom Trigger", ITEM.SUBMENU(["ZoomTrigger","Zoom Trigger"],
ITEM.RADIO("Hover", "zoom", {action: MENU.Zoom}), ITEM.RADIO(["Hover","Hover"], "zoom", {action: MENU.Zoom}),
ITEM.RADIO("Click", "zoom", {action: MENU.Zoom}), ITEM.RADIO(["Click","Click"], "zoom", {action: MENU.Zoom}),
ITEM.RADIO("Double-Click", "zoom", {action: MENU.Zoom}), ITEM.RADIO(["DoubleClick","Double-Click"], "zoom", {action: MENU.Zoom}),
ITEM.RADIO("No Zoom", "zoom", {value: "None"}), ITEM.RADIO(["NoZoom","No Zoom"], "zoom", {value: "None"}),
ITEM.RULE(), ITEM.RULE(),
ITEM.LABEL("Trigger Requires:"), ITEM.LABEL(["TriggerRequires","Trigger Requires:"]),
ITEM.CHECKBOX((HUB.Browser.isMac ? "Option" : "Alt"), "ALT"), ITEM.CHECKBOX((HUB.Browser.isMac ? ["Option","Option"] : ["Alt","Alt"]), "ALT"),
ITEM.CHECKBOX("Command", "CMD", {hidden: !HUB.Browser.isMac}), ITEM.CHECKBOX(["Command","Command"], "CMD", {hidden: !HUB.Browser.isMac}),
ITEM.CHECKBOX("Control", "CTRL", {hidden: HUB.Browser.isMac}), ITEM.CHECKBOX(["Control","Control"], "CTRL", {hidden: HUB.Browser.isMac}),
ITEM.CHECKBOX("Shift", "Shift") ITEM.CHECKBOX(["Shift","Shift"], "Shift")
), ),
ITEM.SUBMENU("Zoom Factor", ITEM.SUBMENU(["ZoomFactor","Zoom Factor"],
ITEM.RADIO("125%", "zscale"), ITEM.RADIO("125%", "zscale"),
ITEM.RADIO("133%", "zscale"), ITEM.RADIO("133%", "zscale"),
ITEM.RADIO("150%", "zscale"), ITEM.RADIO("150%", "zscale"),
@ -985,40 +991,39 @@
ITEM.RADIO("400%", "zscale") ITEM.RADIO("400%", "zscale")
), ),
ITEM.RULE(), ITEM.RULE(),
ITEM.SUBMENU("Math Renderer", {hidden:!CONFIG.showRenderer}, ITEM.SUBMENU(["Renderer","Math Renderer"], {hidden:!CONFIG.showRenderer},
ITEM.RADIO("HTML-CSS", "renderer", {action: MENU.Renderer}), ITEM.RADIO("HTML-CSS", "renderer", {action: MENU.Renderer}),
ITEM.RADIO("MathML", "renderer", {action: MENU.Renderer, value:"NativeMML"}), ITEM.RADIO("MathML", "renderer", {action: MENU.Renderer, value:"NativeMML"}),
ITEM.RADIO("SVG", "renderer", {action: MENU.Renderer}) ITEM.RADIO("SVG", "renderer", {action: MENU.Renderer})
), ),
ITEM.SUBMENU("MathPlayer", {hidden:!HUB.Browser.isMSIE || ITEM.SUBMENU("MathPlayer", {hidden:!HUB.Browser.isMSIE || !CONFIG.showMathPlayer,
!CONFIG.showMathPlayer, disabled:!HUB.Browser.hasMathPlayer},
disabled:!HUB.Browser.hasMathPlayer}, ITEM.LABEL(["MPHandles","Let MathPlayer Handle:"]),
ITEM.LABEL("Let MathPlayer Handle:"), ITEM.CHECKBOX(["MenuEvents","Menu Events"], "mpContext", {action: MENU.MPEvents, hidden:!isIE9}),
ITEM.CHECKBOX("Menu Events", "mpContext", {action: MENU.MPEvents, hidden:!isIE9}), ITEM.CHECKBOX(["MouseEvents","Mouse Events"], "mpMouse", {action: MENU.MPEvents, hidden:!isIE9}),
ITEM.CHECKBOX("Mouse Events", "mpMouse", {action: MENU.MPEvents, hidden:!isIE9}), ITEM.CHECKBOX(["MenuAndMouse","Mouse and Menu Events"], "mpMouse", {action: MENU.MPEvents, hidden:isIE9})
ITEM.CHECKBOX("Mouse and Menu Events", "mpMouse", {action: MENU.MPEvents, hidden:isIE9})
), ),
ITEM.SUBMENU("Font Preference", {hidden:!CONFIG.showFontMenu}, ITEM.SUBMENU(["FontPrefs","Font Preference"], {hidden:!CONFIG.showFontMenu},
ITEM.LABEL("For HTML-CSS:"), ITEM.LABEL(["ForHTMLCSS","For HTML-CSS:"]),
ITEM.RADIO("Auto", "font", {action: MENU.Font}), ITEM.RADIO(["Auto","Auto"], "font", {action: MENU.Font}),
ITEM.RULE(), ITEM.RULE(),
ITEM.RADIO("TeX (local)", "font", {action: MENU.Font}), ITEM.RADIO(["TeXLocal","TeX (local)"], "font", {action: MENU.Font}),
ITEM.RADIO("TeX (web)", "font", {action: MENU.Font}), ITEM.RADIO(["TeXWeb","TeX (web)"], "font", {action: MENU.Font}),
ITEM.RADIO("TeX (image)", "font", {action: MENU.Font}), ITEM.RADIO(["TeXImage","TeX (image)"], "font", {action: MENU.Font}),
ITEM.RULE(), ITEM.RULE(),
ITEM.RADIO("STIX (local)", "font", {action: MENU.Font}) ITEM.RADIO(["STIXlocal","STIX (local)"], "font", {action: MENU.Font})
), ),
ITEM.SUBMENU("Contextual Menu", {hidden:!CONFIG.showContext}, ITEM.SUBMENU(["ContextMenu","Contextual Menu"], {hidden:!CONFIG.showContext},
ITEM.RADIO("MathJax", "context"), ITEM.RADIO("MathJax", "context"),
ITEM.RADIO("Browser", "context") ITEM.RADIO(["Browser","Browser"], "context")
), ),
ITEM.COMMAND("Scale All Math ...",MENU.Scale), ITEM.COMMAND(["Scale","Scale All Math ..."],MENU.Scale),
ITEM.RULE().With({hidden:!CONFIG.showDiscoverable, name:"discover_rule"}), ITEM.RULE().With({hidden:!CONFIG.showDiscoverable, name:["","discover_rule"]}),
ITEM.CHECKBOX("Highlight on Hover", "discoverable", {hidden:!CONFIG.showDiscoverable}) ITEM.CHECKBOX(["Discoverable","Highlight on Hover"], "discoverable", {hidden:!CONFIG.showDiscoverable})
), ),
ITEM.RULE(), ITEM.RULE(),
ITEM.COMMAND("About MathJax",MENU.About), ITEM.COMMAND(["About","About MathJax"],MENU.About),
ITEM.COMMAND("MathJax Help",MENU.Help) ITEM.COMMAND(["Help","MathJax Help"],MENU.Help)
); );
if (MENU.isMobile) { if (MENU.isMobile) {

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/AMSmath.js * MathJax/extensions/TeX/AMSmath.js
@ -24,7 +25,7 @@
*/ */
MathJax.Extension["TeX/AMSmath"] = { MathJax.Extension["TeX/AMSmath"] = {
version: "2.1", version: "2.1.1",
number: 0, // current equation number number: 0, // current equation number
startNumber: 0, // current starting equation number (for when equation is restarted) startNumber: 0, // current starting equation number (for when equation is restarted)
@ -162,15 +163,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (!star) {arg = CONFIG.formatTag(arg)} if (!star) {arg = CONFIG.formatTag(arg)}
var global = this.stack.global; global.tagID = tag; var global = this.stack.global; global.tagID = tag;
if (global.notags) { if (global.notags) {
TEX.Error(MathJax.Localization._(["TeX", "CommandNotAllowedInEnv"], TEX.Error(["CommandNotAllowedInEnv",
"%1 not allowed in %2 environment", "%1 not allowed in %2 environment",
name, global.notags) name,global.notags]
) );
}
if (global.tag) {
TEX.Error(MathJax.Localization._(["TeX", "MultipleCommand"],
"Multiple %1", name))
} }
if (global.tag) {TEX.Error(["MultipleCommand","Multiple %1",name])}
global.tag = MML.mtd.apply(MML,this.InternalMath(arg)).With({id:CONFIG.formatID(tag)}); global.tag = MML.mtd.apply(MML,this.InternalMath(arg)).With({id:CONFIG.formatID(tag)});
}, },
HandleNoTag: function (name) { HandleNoTag: function (name) {
@ -185,16 +183,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var global = this.stack.global, label = this.GetArgument(name); var global = this.stack.global, label = this.GetArgument(name);
if (label === "") return; if (label === "") return;
if (!AMS.refUpdate) { if (!AMS.refUpdate) {
if (global.label) { if (global.label) {TEX.Error(["MultipleCommand","Multiple %1",name])}
TEX.Error(MathJax.Localization._(["TeX", "MultipleCommand"],
"Multiple %1", name))
}
global.label = label; global.label = label;
if (AMS.labels[label] || AMS.eqlabels[label]) { if (AMS.labels[label] || AMS.eqlabels[label])
TEX.Error(MathJax.Localization._(["TeX", "MultipleLabel"], {TEX.Error(["MultipleLabel","Label '%1' mutiply defined",label])}
"Label '%1' mutiply defined",
label)
}
AMS.eqlabels[label] = "???"; // will be replaced by tag value later AMS.eqlabels[label] = "???"; // will be replaced by tag value later
} }
}, },
@ -239,8 +231,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
HandleShove: function (name,shove) { HandleShove: function (name,shove) {
var top = this.stack.Top(); var top = this.stack.Top();
if (top.type !== "multline" || top.data.length) { if (top.type !== "multline" || top.data.length) {
TEX.Error(MathJax.Localization._(["TeX", "CommandAtTheBeginingOfLine", TEX.Error(["CommandAtTheBeginingOfLine",
"%1 must come at the beginning of the line")) "%1 must come at the beginning of the line",name]);
} }
top.data.shove = shove; top.data.shove = shove;
}, },
@ -255,11 +247,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var frac = MML.mfrac(TEX.Parse('\\strut\\textstyle{'+num+'}',this.stack.env).mml(), var frac = MML.mfrac(TEX.Parse('\\strut\\textstyle{'+num+'}',this.stack.env).mml(),
TEX.Parse('\\strut\\textstyle{'+den+'}',this.stack.env).mml()); TEX.Parse('\\strut\\textstyle{'+den+'}',this.stack.env).mml());
lr = ({l:MML.ALIGN.LEFT, r:MML.ALIGN.RIGHT,"":""})[lr]; lr = ({l:MML.ALIGN.LEFT, r:MML.ALIGN.RIGHT,"":""})[lr];
if (lr == null) { if (lr == null)
TEX.Error(MathJax.Localization._(["TeX", "IllegalAlign"], {TEX.Error(["IllegalAlign","Illegal alignment specified in %1",name])}
"Illegal alignment specified in %1",
name))
}
if (lr) {frac.numalign = frac.denomalign = lr} if (lr) {frac.numalign = frac.denomalign = lr}
this.Push(frac); this.Push(frac);
}, },
@ -279,10 +268,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (left || right) {frac = MML.mfenced(frac).With({open: left, close: right})} if (left || right) {frac = MML.mfenced(frac).With({open: left, close: right})}
if (style !== "") { if (style !== "") {
var STYLE = (["D","T","S","SS"])[style]; var STYLE = (["D","T","S","SS"])[style];
if (STYLE == null) { if (STYLE == null)
TEX.Error(MathJax.Localization._(["TeX", "BadMathStyleFor"], {TEX.Error(["BadMathStyleFor","Bad math style for %1",name])}
"Bad math style for %1", name)
}
frac = MML.mstyle(frac); frac = MML.mstyle(frac);
if (STYLE === "D") {frac.displaystyle = true; frac.scriptlevel = 0} if (STYLE === "D") {frac.displaystyle = true; frac.scriptlevel = 0}
else {frac.displaystyle = false; frac.scriptlevel = style - 1} else {frac.displaystyle = false; frac.scriptlevel = style - 1}
@ -334,9 +321,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (!taggable) {valign = this.GetBrackets("\\begin{"+begin.name+"}")} if (!taggable) {valign = this.GetBrackets("\\begin{"+begin.name+"}")}
n = this.GetArgument("\\begin{"+begin.name+"}"); n = this.GetArgument("\\begin{"+begin.name+"}");
if (n.match(/[^0-9]/)) { if (n.match(/[^0-9]/)) {
TEX.Error(MathJax.Localization._(["TeX", "PositiveIntegerArg"], TEX.Error(["PositiveIntegerArg","Argument to %1 must me a positive integer",
"Argument to %1 must me a positive integer"), "\\begin{"+begin.name+"}"]);
"\\begin{"+begin.name+"}")
} }
while (n > 0) {align += "rl"; spacing.push("0em 0em"); n--} while (n > 0) {align += "rl"; spacing.push("0em 0em"); n--}
spacing = spacing.join(" "); spacing = spacing.join(" ");
@ -362,12 +348,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
* Check for bad nesting of equation environments * Check for bad nesting of equation environments
*/ */
checkEqnEnv: function () { checkEqnEnv: function () {
if (this.stack.global.eqnenv) { if (this.stack.global.eqnenv)
TEX.Error( {TEX.Error(["ErroneousNestingEq","Erroneous nesting of equation structures"])}
MathJax.Localization._(["TeX", "ErroneousNestingEq"],
"Erroneous nesting of equation structures")
)
}
this.stack.global.eqnenv = true; this.stack.global.eqnenv = true;
}, },
@ -413,9 +395,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var c = this.trimSpaces(this.GetArgument(name)); var c = this.trimSpaces(this.GetArgument(name));
if (c == "") {return null} if (c == "") {return null}
if (TEXDEF.delimiter[c] == null) { if (TEXDEF.delimiter[c] == null) {
TEX.Error(MathJax.Localization._(["TeX", TEX.Error(["MissingOrUnrecognizedDelim",
"MissingOrUnrecognizedDelim"], "Missing or unrecognized delimiter for %1",name]);
"Missing or unrecognized delimiter for %1", name))
} }
return this.convertDelimiter(c); return this.convertDelimiter(c);
}, },
@ -479,10 +460,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
}, },
EndRow: function () { EndRow: function () {
if (this.row.length != 1) { if (this.row.length != 1) {
TEX.Error( TEX.Error(["MultipleRowsOneCol",
MathJax.Localization._(["TeX", "MultipleRowsOneCol"], "multline rows must have exactly one column"]);
"multline rows must have exactly one column")
)
} }
this.table.push(this.row); this.row = []; this.table.push(this.row); this.row = [];
}, },

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/bbox.js * MathJax/extensions/TeX/bbox.js
@ -45,7 +46,7 @@
*/ */
MathJax.Extension["TeX/bbox"] = { MathJax.Extension["TeX/bbox"] = {
version: "2.1" version: "2.1.1"
}; };
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
@ -64,39 +65,24 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var part = parts[i].replace(/^\s+/,'').replace(/\s+$/,''); var part = parts[i].replace(/^\s+/,'').replace(/\s+$/,'');
var match = part.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/); var match = part.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/);
if (match) { if (match) {
if (def)
{TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Padding",name])}
var pad = match[1]+match[3]; var pad = match[1]+match[3];
if (def) {
TEX.Error(
MathJax.Localization._(
["TeX", "MultipleBboxProperty"],
"%1 specified twice in %2", "Padding", name)
)
}
def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]}; def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]};
} else if (part.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)) { } else if (part.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)) {
if (background) { if (background)
TEX.Error( {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Background",name])}
MathJax.Localization._(
["TeX", "MultipleBboxProperty"],
"%1 specified twice in %2", "Background", name)
)
}
background = part; background = part;
} else if (part.match(/^[-a-z]+:/i)) { } else if (part.match(/^[-a-z]+:/i)) {
if (style) { if (style)
TEX.Error( {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2", "Style",name])}
MathJax.Localization._(
["TeX", "MultipleBboxProperty"],
"%1 specified twice in %2", "Style", name)
)
}
style = part; style = part;
} else if (part !== "") { } else if (part !== "") {
TEX.Error( TEX.Error(
MathJax.Localization._( ["InvalidBBoxProperty",
["TeX", "InvalidBboxProperty"], "'%1' doesn't look like a color, a padding dimension, or a style",
"'%1' doesn't look like a color, a padding dimension, or a style", part]
part); );
} }
} }
if (def) {math = MML.mpadded(math).With(def)} if (def) {math = MML.mpadded(math).With(def)}

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/begingroup.js * MathJax/extensions/TeX/begingroup.js
@ -25,7 +26,7 @@
*/ */
MathJax.Extension["TeX/begingroup"] = { MathJax.Extension["TeX/begingroup"] = {
version: "2.1" version: "2.1.1"
}; };
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
@ -215,12 +216,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (TEX.eqnStack.top > 1) { if (TEX.eqnStack.top > 1) {
TEX.eqnStack.Pop(); TEX.eqnStack.Pop();
} else if (TEX.rootStack.top === 1) { } else if (TEX.rootStack.top === 1) {
TEX.Error( TEX.Error(["ExtraEndMissingBegin","Extra %1 or missing \\begingroup",name]);
MathJax.Localization._(
["TeX", "ExtraEndMissingBegin"],
"Extra %1 or missing \\begingroup", name
)
)
} else { } else {
TEX.eqnStack.Clear(); TEX.eqnStack.Clear();
TEX.rootStack.Pop(); TEX.rootStack.Pop();
@ -296,11 +292,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
Global: function (name) { Global: function (name) {
var i = this.i; var cs = this.GetCSname(name); this.i = i; var i = this.i; var cs = this.GetCSname(name); this.i = i;
if (cs !== "let" && cs !== "def" && cs !== "newcommand") { if (cs !== "let" && cs !== "def" && cs !== "newcommand") {
TEX.Error( TEX.Error(["GlobalNotFollowedBy",
MathJax.Localization._( "%1 not followed by \\let, \\def, or \\newcommand",name]);
["TeX", "GlobalNotFollowedBy"],
"%1 not followed by \\let, \\def, or \\newcommand", name)
)
} }
this.stack.env.isGlobal = true; this.stack.env.isGlobal = true;
} }

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/color.js * MathJax/extensions/TeX/color.js
@ -30,7 +31,7 @@
// The configuration defaults, augmented by the user settings // The configuration defaults, augmented by the user settings
// //
MathJax.Extension["TeX/color"] = { MathJax.Extension["TeX/color"] = {
version: "2.1", version: "2.1.1",
config: MathJax.Hub.CombineConfig("TeX.color",{ config: MathJax.Hub.CombineConfig("TeX.color",{
padding: "5px", padding: "5px",
@ -114,12 +115,7 @@ MathJax.Extension["TeX/color"] = {
getColor: function (model,def) { getColor: function (model,def) {
if (!model) {model = "named"} if (!model) {model = "named"}
var fn = this["get_"+model]; var fn = this["get_"+model];
if (!fn) { if (!fn) {this.TEX.Error(["UndefinedColorModel","Color model '%1' not defined",model])}
this.TEX.Error(
MathJax.Localization._(["TeX", "UndefinedColorModel"],
"Color model '%1' not defined", model)
)
}
return fn.call(this,def); return fn.call(this,def);
}, },
@ -128,24 +124,14 @@ MathJax.Extension["TeX/color"] = {
*/ */
get_rgb: function (rgb) { get_rgb: function (rgb) {
rgb = rgb.split(/,/); var RGB = "#"; rgb = rgb.split(/,/); var RGB = "#";
if (rgb.length !== 3) { if (rgb.length !== 3)
this.TEX.Error(MathJax.Localization._(["TeX", "rgbArg1"], {this.TEX.Error(["rgbArg1","rgb colors require 3 decimal numbers"])}
"rgb colors require 3 decimal numbers"))
}
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/)) { if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/))
this.TEX.Error( {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])}
MathJax.Localization._(["TeX", "InvalidDecimalNumber"],
"Invalid decimal number")
)
}
var n = parseFloat(rgb[i]); var n = parseFloat(rgb[i]);
if (n < 0 || n > 1) { if (n < 0 || n > 1)
this.TEX.Error( {this.TEX.Error(["rgbArg2","rgb values must be between 0 and 1"])}
MathJax.Localization._(["TeX", "rgbArg2"],
"rgb values must be between 0 and 1")
)
}
n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n}
RGB += n; RGB += n;
} }
@ -157,22 +143,14 @@ MathJax.Extension["TeX/color"] = {
*/ */
get_RGB: function (rgb) { get_RGB: function (rgb) {
rgb = rgb.split(/,/); var RGB = "#"; rgb = rgb.split(/,/); var RGB = "#";
if (rgb.length !== 3) { if (rgb.length !== 3)
this.TEX.Error(MathJax.Localization._(["TeX", "RGBArg1"], {this.TEX.Error(["RGBArg1","RGB colors require 3 numbers"])}
"RGB colors require 3 numbers"))
}
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
if (!rgb[i].match(/^\d+$/)) { if (!rgb[i].match(/^\d+$/))
this.TEX.Error(MathJax.Localization._(["TeX", "InvalidNumber"], {this.TEX.Error(["InvalidNumber","Invalid number"])}
"Invalid number"))
}
var n = parseInt(rgb[i]); var n = parseInt(rgb[i]);
if (n > 255) { if (n > 255)
this.TEX.Error( {this.TEX.Error(["RGBArg2","RGB values must be between 0 and 255"])}
MathJax.Localization._(["TeX", "RGBArg2"],
"RGB values must be between 0 and 255")
)
}
n = n.toString(16); if (n.length < 2) {n = "0"+n} n = n.toString(16); if (n.length < 2) {n = "0"+n}
RGB += n; RGB += n;
} }
@ -183,18 +161,11 @@ MathJax.Extension["TeX/color"] = {
* Get a gray-scale value * Get a gray-scale value
*/ */
get_gray: function (gray) { get_gray: function (gray) {
if (!gray.match(/^(\d+(\.\d*)?|\.\d+)$/)) { if (!gray.match(/^(\d+(\.\d*)?|\.\d+)$/))
this.TEX.Error( {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])}
MathJax.Localization._(["TeX", "InvalidDecimalNumber"],
"Invalid decimal number")
)
}
var n = parseFloat(gray); var n = parseFloat(gray);
if (n < 0 || n > 1) { if (n < 0 || n > 1)
this.TEX.Error( {this.TEX.Error(["GrayScalerArg","Grey-scale values must be between 0 and 1"])}
MathJax.Localization._(["TeX", "GrayScalerArg"],
"Grey-scale values must be between 0 and 1"))
}
n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n}
return "#"+n+n+n; return "#"+n+n+n;
}, },

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/extpfeil.js * MathJax/extensions/TeX/extpfeil.js
@ -24,7 +25,7 @@
*/ */
MathJax.Extension["TeX/extpfeil"] = { MathJax.Extension["TeX/extpfeil"] = {
version: "2.1" version: "2.1.1"
}; };
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
@ -73,23 +74,22 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
space = this.GetArgument(name), space = this.GetArgument(name),
chr = this.GetArgument(name); chr = this.GetArgument(name);
if (!cs.match(/^\\([a-z]+|.)$/i)) { if (!cs.match(/^\\([a-z]+|.)$/i)) {
TEX.Error( TEX.Error(["NewextarrowArg1",
MathJax.Localization._(["TeX", "NewextarrowArg1"] "First argument to %1 must be a control sequence name",name]);
"First argument to %1 must be a control sequence name", name)
)
} }
if (!space.match(/^(\d+),(\d+)$/)) { if (!space.match(/^(\d+),(\d+)$/)) {
TEX.Error( TEX.Error(
MathJax.Localization._(["TeX", "NewextarrowArg2"] ["NewextarrowArg2",
"Second argument to %1 must be two integers separated by a comma", "Second argument to %1 must be two integers separated by a comma",
name) name]
) );
} }
if (!chr.match(/^(\d+|0x[0-9A-F]+)$/i)) { if (!chr.match(/^(\d+|0x[0-9A-F]+)$/i)) {
TEX.Error( TEX.Error(
MathJax.Localization._(["TeX", "NewextarrowArg3"] ["NewextarrowArg3",
"Third argument to %1 must be a unicode character number", name) "Third argument to %1 must be a unicode character number",
) name]
);
} }
cs = cs.substr(1); space = space.split(","); chr = parseInt(chr); cs = cs.substr(1); space = space.split(","); chr = parseInt(chr);
TEXDEF.macros[cs] = ['xArrow',chr,parseInt(space[0]),parseInt(space[1])]; TEXDEF.macros[cs] = ['xArrow',chr,parseInt(space[0]),parseInt(space[1])];

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/mhchem.js * MathJax/extensions/TeX/mhchem.js
@ -25,7 +26,7 @@
*/ */
MathJax.Extension["TeX/mhchem"] = { MathJax.Extension["TeX/mhchem"] = {
version: "2.1" version: "2.1.1"
}; };
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
@ -353,21 +354,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (C === "}") { if (C === "}") {
if (braces) {braces--} if (braces) {braces--}
else { else {
TEX.Error( TEX.Error(["ExtraCloseMissingOpen","Extra close brace or missing open brace"])
MathJax.Localization._(
["TeX", "ExtraCloseMissingOpen"],
"Extra close brace or missing open brace"
)
)
} }
} }
} }
if (braces) { if (braces) {TEX.Error(["MissingCloseBrace","Missing close brace"])}
TEX.Error(MathJax.Localization._(["TeX", "MissingCloseBrace"], TEX.Error(["NoClosingChar","Can't find closing %1",c]);
"Missing close brace"))
};
TEX.Error(MathJax.Localization._(["TeX", "NoClosingChar"],
"Can't find closing %1", c)
} }
}); });

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/newcommand.js * MathJax/extensions/TeX/newcommand.js
@ -25,16 +26,11 @@
*/ */
MathJax.Extension["TeX/newcommand"] = { MathJax.Extension["TeX/newcommand"] = {
version: "2.1" version: "2.1.1"
}; };
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var _ = function (id) {
return MathJax.Localization._.apply(MathJax.Localization,
[ ["TeX", id] ].concat([].slice.call(arguments,1)))
};
var TEX = MathJax.InputJax.TeX; var TEX = MathJax.InputJax.TeX;
var TEXDEF = TEX.Definitions; var TEXDEF = TEX.Definitions;
@ -61,14 +57,14 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
def = this.GetArgument(name); def = this.GetArgument(name);
if (cs.charAt(0) === "\\") {cs = cs.substr(1)} if (cs.charAt(0) === "\\") {cs = cs.substr(1)}
if (!cs.match(/^(.|[a-z]+)$/i)) { if (!cs.match(/^(.|[a-z]+)$/i)) {
TEX.Error(_("IllegalControlSequenceName", TEX.Error(["IllegalControlSequenceName",
"Illegal control sequence name for %1", name)) "Illegal control sequence name for %1",name]);
} }
if (n) { if (n) {
n = this.trimSpaces(n); n = this.trimSpaces(n);
if (!n.match(/^[0-9]+$/)) { if (!n.match(/^[0-9]+$/)) {
TEX.Error(_("IllegalParamNumber" TEX.Error(["IllegalParamNumber",
"Illegal number of parameters specified in %1", name)) "Illegal number of parameters specified in %1",name]);
} }
} }
this.setDef(cs,['Macro',def,n,opt]); this.setDef(cs,['Macro',def,n,opt]);
@ -85,8 +81,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (n) { if (n) {
n = this.trimSpaces(n); n = this.trimSpaces(n);
if (!n.match(/^[0-9]+$/)) { if (!n.match(/^[0-9]+$/)) {
TEX.Error(_("IllegalParamNumber" TEX.Error(["IllegalParamNumber",
"Illegal number of parameters specified in %1", name)) "Illegal number of parameters specified in %1",name]);
} }
} }
this.setEnv(env,['BeginEnv','EndEnv',bdef,edef,n]); this.setEnv(env,['BeginEnv','EndEnv',bdef,edef,n]);
@ -145,8 +141,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
GetCSname: function (cmd) { GetCSname: function (cmd) {
var c = this.GetNext(); var c = this.GetNext();
if (c !== "\\") { if (c !== "\\") {
TEX.Error(_("DoubleBackSlash", TEX.Error(["DoubleBackSlash",
"\\ must be followed by a control sequence")) "\\ must be followed by a control sequence"])
} }
var cs = this.trimSpaces(this.GetArgument(cmd)); var cs = this.trimSpaces(this.GetArgument(cmd));
return cs.substr(1); return cs.substr(1);
@ -164,13 +160,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (i !== this.i) {params[n] = this.string.substr(i,this.i-i)} if (i !== this.i) {params[n] = this.string.substr(i,this.i-i)}
c = this.string.charAt(++this.i); c = this.string.charAt(++this.i);
if (!c.match(/^[1-9]$/)) { if (!c.match(/^[1-9]$/)) {
TEX.Error(_("CantUseHash2", TEX.Error(["CantUseHash2",
"Illegal use of # in template for %1", cs)) "Illegal use of # in template for %1",cs]);
} }
if (parseInt(c) != ++n) { if (parseInt(c) != ++n) {
TEX.Error(_( TEX.Error(["SequentialParam",
"SequentialParam", "Parameters for %1 must be numbered sequentially",cs]);
"Parameters for %1 must be numbered sequentially", cs))
} }
i = this.i+1; i = this.i+1;
} else if (c === '{') { } else if (c === '{') {
@ -179,8 +174,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
} }
this.i++; this.i++;
} }
TEX.Error(_("MissingReplacementString", TEX.Error(["MissingReplacementString",
"Missing replacement string for definition of %1", cmd)); "Missing replacement string for definition of %1",cmd]);
}, },
/* /*
@ -190,10 +185,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (n) { if (n) {
var args = []; this.GetNext(); var args = []; this.GetNext();
if (params[0] && !this.MatchParam(params[0])) { if (params[0] && !this.MatchParam(params[0])) {
TEX.Error( TEX.Error(["MismatchUseDef",
_("MismatchUseDef", "Use of %1 doesn't match its definition",name]);
"Use of %1 doesn't match its definition", name))
)
} }
for (var i = 0; i < n; i++) {args.push(this.GetParameter(name,params[i+1]))} for (var i = 0; i < n; i++) {args.push(this.GetParameter(name,params[i+1]))}
text = this.SubstituteArgs(args,text); text = this.SubstituteArgs(args,text);
@ -201,10 +194,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
this.string = this.AddArgs(text,this.string.slice(this.i)); this.string = this.AddArgs(text,this.string.slice(this.i));
this.i = 0; this.i = 0;
if (++this.macroCount > TEX.config.MAXMACROS) { if (++this.macroCount > TEX.config.MAXMACROS) {
TEX.Error( TEX.Error(["MaxMacroSub1",
_("MaxMacroSub1", "MathJax maximum macro substitution count exceeded; " +
"MathJax maximum macro substitution count exceeded; is there a recursive macro call?") "is there a recursive macro call?"]);
)
} }
}, },
@ -244,9 +236,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
this.i++; j++; hasBraces = 0; this.i++; j++; hasBraces = 0;
} }
} }
TEX.Error( TEX.Error(["RunawayArgument","Runaway argument for %1?",name]);
_("RunawayArgument", "Runaway argument for %1?", name)
);
}, },
/* /*

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/extensions/TeX/verb.js * MathJax/extensions/TeX/verb.js
@ -25,7 +26,7 @@
*/ */
MathJax.Extension["TeX/verb"] = { MathJax.Extension["TeX/verb"] = {
version: "2.1" version: "2.1.1"
}; };
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
@ -43,19 +44,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
*/ */
Verb: function (name) { Verb: function (name) {
var c = this.GetNext(); var start = ++this.i; var c = this.GetNext(); var start = ++this.i;
if (c == "" ) { if (c == "" ) {TEX.Error(["MissingArgFor","Missing argument for %1",name])}
TEX.Error(
MathJax.Localization._(
["TeX", "MissingArgFor"],
"Argument manquant pour la commande %1", name))
}
while (this.i < this.string.length && this.string.charAt(this.i) != c) {this.i++} while (this.i < this.string.length && this.string.charAt(this.i) != c) {this.i++}
if (this.i == this.string.length) { if (this.i == this.string.length)
TEX.Error( {TEX.Error(["NoClosingDelim","Can't find closing delimiter for %1", name])}
MathJax.Localization._(
["TeX", "NoClosinDelim"],
"Can't find closing delimiter for %1", name))
}
var text = this.string.slice(start,this.i); this.i++; var text = this.string.slice(start,this.i); this.i++;
this.Push(MML.mtext(text).With({mathvariant:MML.VARIANT.MONOSPACE})); this.Push(MML.mtext(text).With({mathvariant:MML.VARIANT.MONOSPACE}));
} }

View File

@ -27,7 +27,7 @@
MathJax.InputJax.AsciiMath = MathJax.InputJax({ MathJax.InputJax.AsciiMath = MathJax.InputJax({
id: "AsciiMath", id: "AsciiMath",
version: "2.1", version: "2.1.1",
directory: MathJax.InputJax.directory + "/AsciiMath", directory: MathJax.InputJax.directory + "/AsciiMath",
extensionDir: MathJax.InputJax.extensionDir + "/AsciiMath", extensionDir: MathJax.InputJax.extensionDir + "/AsciiMath",

View File

@ -1268,7 +1268,7 @@ junk = null;
var MML; var MML;
ASCIIMATH.Augment({ ASCIIMATH.Augment({
sourceMenuTitle: "AsciiMath Input", sourceMenuTitle: /*_(MathMenu)*/ ["AsciiMathInput","AsciiMath Input"],
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing AsciiMath prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing AsciiMath
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing AsciiMath postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing AsciiMath

View File

@ -24,7 +24,7 @@
MathJax.InputJax.MathML = MathJax.InputJax({ MathJax.InputJax.MathML = MathJax.InputJax({
id: "MathML", id: "MathML",
version: "2.1", version: "2.1.1",
directory: MathJax.InputJax.directory + "/MathML", directory: MathJax.InputJax.directory + "/MathML",
extensionDir: MathJax.InputJax.extensionDir + "/MathML", extensionDir: MathJax.InputJax.extensionDir + "/MathML",
entityDir: MathJax.InputJax.directory + "/MathML/entities", entityDir: MathJax.InputJax.directory + "/MathML/entities",

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/jax/input/MathML/jax.js * MathJax/jax/input/MathML/jax.js
@ -29,8 +30,8 @@
var MML; var MML;
var _ = function (id) { var _ = function (id) {
return MathJax.Localization._.apply(MathJax.Localization,[ return MathJax.Localization._.apply(MathJax.Localization,
["MathML",id] ].concat([].slice.call(arguments,1))) [["MathML",id]].concat([].slice.call(arguments,1)))
}; };
MATHML.Parse = MathJax.Object.Subclass({ MATHML.Parse = MathJax.Object.Subclass({
@ -54,33 +55,23 @@
math = math.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\s*$/,"$2"); math = math.replace(/^\s*(?:\/\/)?<!(--)?\[CDATA\[((.|\n)*)(\/\/)?\]\]\1>\s*$/,"$2");
math = math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); math = math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity);
doc = MATHML.ParseXML(math); doc = MATHML.ParseXML(math);
if (doc == null) { if (doc == null) {MATHML.Error(["ErrorParsingMathML","Error parsing MathML"])}
MATHML.Error(_("ErrorParsingMathML", "Error parsing MathML"))
}
} }
var err = doc.getElementsByTagName("parsererror")[0]; var err = doc.getElementsByTagName("parsererror")[0];
// Localization: This seems to replace error messages produced if (err) MATHML.Error(["ParsingError","Error parsing MathML: %1",
// by browsers. Does that work in all languages? err.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,"")]);
if (err) MATHML.Error("Error parsing MathML: "+err.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,"")); if (doc.childNodes.length !== 1)
if (doc.childNodes.length !== 1) { {MATHML.Error(["MathMLSingleElement","MathML must be formed by a single element"])}
MATHML.Error(
_("MathMLSingleElement", "MathML must be formed by a single element")
);
}
if (doc.firstChild.nodeName.toLowerCase() === "html") { if (doc.firstChild.nodeName.toLowerCase() === "html") {
var h1 = doc.getElementsByTagName("h1")[0]; var h1 = doc.getElementsByTagName("h1")[0];
if (h1 && h1.textContent === "XML parsing error" && h1.nextSibling) if (h1 && h1.textContent === "XML parsing error" && h1.nextSibling)
// Localization: This seems to replace error messages produced MATHML.Error(["ParsingError","Error parsing MathML: %1",
// by browsers. Does that work in all languages? String(h1.nextSibling.nodeValue).replace(/fatal parsing error: /,"")]);
MATHML.Error("Error parsing MathML: "+String(h1.nextSibling.nodeValue).replace(/fatal parsing error: /,""));
} }
if (doc.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") !== if (doc.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") !== "math") {
"math") { MATHML.Error(["MathMLRootElement",
MATHML.Error(
_("MathMLRootElement",
"MathML must be formed by a <math> element, not %1", "MathML must be formed by a <math> element, not %1",
"<"+doc.firstChild.nodeName+">") "<"+doc.firstChild.nodeName+">"]);
);
} }
this.mml = this.MakeMML(doc.firstChild); this.mml = this.MakeMML(doc.firstChild);
}, },
@ -96,10 +87,7 @@
mml = this.TeXAtom(match[2]); mml = this.TeXAtom(match[2]);
} else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) { } else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) {
MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]); MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]);
return MML.merror( return MML.merror(_("UnknownNodeType","Unknown node type: %1",type));
MathJax.Localization._(
"UnknownNodeType", "Unknown node type: %1", type)
);
} else { } else {
mml = MML[type](); mml = MML[type]();
} }
@ -175,10 +163,8 @@
var text = child.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); var text = child.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity);
mml.Append(MML.chars(this.trimSpace(text))); mml.Append(MML.chars(this.trimSpace(text)));
} else if (child.nodeValue.match(/\S/)) { } else if (child.nodeValue.match(/\S/)) {
MATHML.Error( MATHML.Error(["UnexpectedTextNode",
_("UnexpectedTextNode", "Unexpected text node: %1", "Unexpected text node: %1","'"+child.nodeValue+"'"]);
"'"+child.nodeValue+"'")
);
} }
} else if (mml.type === "annotation-xml") { } else if (mml.type === "annotation-xml") {
mml.Append(MML.xml(child)); mml.Append(MML.xml(child));
@ -223,7 +209,7 @@
/************************************************************************/ /************************************************************************/
MATHML.Augment({ MATHML.Augment({
sourceMenuTitle: "Original MathML", sourceMenuTitle: /*_(MathMenu)*/ ["OriginalMathML","Original MathML"],
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing MathML prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing MathML
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing MathML postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing MathML
@ -257,6 +243,10 @@
return MML.merror(message); return MML.merror(message);
}, },
Error: function (message) { Error: function (message) {
//
// Translate message if it is ["id","message",args]
//
if (message instanceof Array) {message = _.apply(_,message)}
throw MathJax.Hub.Insert(Error(message),{mathmlError: true}); throw MathJax.Hub.Insert(Error(message),{mathmlError: true});
}, },
// //
@ -282,12 +272,7 @@
for (var i = 0, m = xml.length; i < m && !this.parser; i++) for (var i = 0, m = xml.length; i < m && !this.parser; i++)
{try {this.parser = new ActiveXObject(xml[i])} catch (err) {}} {try {this.parser = new ActiveXObject(xml[i])} catch (err) {}}
if (!this.parser) { if (!this.parser) {
alert("MathJax can't create an XML parser for MathML. Check that\n"+ MathJax.Localization.Try(this.parserCreationError);
"the 'Script ActiveX controls marked safe for scripting' security\n"+
"setting is enabled (use the Internet Options item in the Tools\n"+
"menu, and select the Security panel, then press the Custom Level\n"+
"button to check this).\n\n"+
"MathML equations will not be able to be processed by MathJax.");
return(this.parseError); return(this.parseError);
} }
this.parser.async = false; this.parser.async = false;
@ -301,6 +286,15 @@
else {document.body.insertBefore(this.div,document.body.firstChild)} else {document.body.insertBefore(this.div,document.body.firstChild)}
return(this.parseDIV); return(this.parseDIV);
}, },
parserCreationError: function () {
alert(_("MathPlayer",
"MathJax can't create an XML parser for MathML. Check that\n"+
"the 'Script ActiveX controls marked safe for scripting' security\n"+
"setting is enabled (use the Internet Options item in the Tools\n"+
"menu, and select the Security panel, then press the Custom Level\n"+
"button to check this).\n\n"+
"MathML equations will not be able to be processed by MathJax."));
},
// //
// Initialize the parser object (whichever type is used) // Initialize the parser object (whichever type is used)
// //

View File

@ -24,7 +24,7 @@
MathJax.InputJax.TeX = MathJax.InputJax({ MathJax.InputJax.TeX = MathJax.InputJax({
id: "TeX", id: "TeX",
version: "2.1", version: "2.1.1",
directory: MathJax.InputJax.directory + "/TeX", directory: MathJax.InputJax.directory + "/TeX",
extensionDir: MathJax.InputJax.extensionDir + "/TeX", extensionDir: MathJax.InputJax.extensionDir + "/TeX",

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/jax/input/TeX/jax.js * MathJax/jax/input/TeX/jax.js
@ -30,7 +31,7 @@
var _ = function (id) { var _ = function (id) {
return MathJax.Localization._.apply(MathJax.Localization, return MathJax.Localization._.apply(MathJax.Localization,
[ ["TeX", id] ].concat([].slice.call(arguments,1))) [["TeX", id]].concat([].slice.call(arguments,1)));
}; };
var STACK = MathJax.Object.Subclass({ var STACK = MathJax.Object.Subclass({
@ -79,14 +80,8 @@
var STACKITEM = STACK.Item = MathJax.Object.Subclass({ var STACKITEM = STACK.Item = MathJax.Object.Subclass({
type: "base", type: "base",
// Localization: should be updated when the language is changed closeError: ["ExtraCloseMissingOpen","Extra close brace or missing open brace"],
// This is used in TEX.Error(this[item.type+"Error"]) below, perhaps a if rightError: ["MissingLeftExtraRight","Missing \\left or extra \\right"],
// could just be used directly, or make the messageID contains close/right
// Add a note about the \\ syntax.
closeError: _("ExtraCloseMissingOpen",
"Extra close brace or missing open brace"),
rightError: _("MissingLeftExtraRight",
"Missing \\left or extra \\right"),
Init: function () { Init: function () {
if (this.isOpen) {this.env = {}} if (this.isOpen) {this.env = {}}
this.data = []; this.data = [];
@ -103,7 +98,7 @@
if (item.type === "over" && this.isOpen) {item.num = this.mmlData(false); this.data = []} if (item.type === "over" && this.isOpen) {item.num = this.mmlData(false); this.data = []}
if (item.type === "cell" && this.isOpen) { if (item.type === "cell" && this.isOpen) {
if (item.linebreak) {return false} if (item.linebreak) {return false}
TEX.Error(_("Misplaced %1", "Misplaced ", item.name)); TEX.Error(["Misplaced %1","Misplaced ",item.name]);
} }
if (item.isClose && this[item.type+"Error"]) {TEX.Error(this[item.type+"Error"])} if (item.isClose && this[item.type+"Error"]) {TEX.Error(this[item.type+"Error"])}
if (!item.isNotStack) {return true} if (!item.isNotStack) {return true}
@ -134,12 +129,10 @@
STACKITEM.open = STACKITEM.Subclass({ STACKITEM.open = STACKITEM.Subclass({
type: "open", isOpen: true, type: "open", isOpen: true,
// Localization: should be updated when the language is changed stopError: ["ExtraOpenMissingClose","Extra open brace or missing close brace"],
stopError: _("ExtraOpenMissingClose",
"Extra open brace or missing close brace"),
checkItem: function (item) { checkItem: function (item) {
if (item.type === "close") { if (item.type === "close") {
var mml = this.mmlData(); // this.mmlData(true,true); // force row var mml = this.mmlData();
return STACKITEM.mml(MML.TeXAtom(mml)); // TeXAtom make it an ORD to prevent spacing (FIXME: should be another way) return STACKITEM.mml(MML.TeXAtom(mml)); // TeXAtom make it an ORD to prevent spacing (FIXME: should be another way)
} }
return this.SUPER(arguments).checkItem.call(this,item); return this.SUPER(arguments).checkItem.call(this,item);
@ -162,9 +155,7 @@
STACKITEM.subsup = STACKITEM.Subclass({ STACKITEM.subsup = STACKITEM.Subclass({
type: "subsup", type: "subsup",
// Localization: should be updated when the language is changed stopError: ["MissingScript","Missing superscript or subscript argument"],
stopError: _("MissingScript",
"Missing superscript or subscript argument"),
checkItem: function (item) { checkItem: function (item) {
var script = ["","subscript","superscript"][this.position]; var script = ["","subscript","superscript"][this.position];
if (item.type === "open" || item.type === "left") {return true} if (item.type === "open" || item.type === "left") {return true}
@ -176,10 +167,8 @@
this.data[0].SetData(this.position,item.data[0]); this.data[0].SetData(this.position,item.data[0]);
return STACKITEM.mml(this.data[0]); return STACKITEM.mml(this.data[0]);
} }
if (this.SUPER(arguments).checkItem.call(this,item)) { if (this.SUPER(arguments).checkItem.call(this,item))
TEX.Error(_("MissingOpenForScript", {TEX.Error(["MissingOpenForScript","Missing open brace for %1",script])}
"Missing open brace for %1", script))
}
}, },
Pop: function () {} Pop: function () {}
}); });
@ -187,9 +176,8 @@
STACKITEM.over = STACKITEM.Subclass({ STACKITEM.over = STACKITEM.Subclass({
type: "over", isClose: true, name: "\\over", type: "over", isClose: true, name: "\\over",
checkItem: function (item,stack) { checkItem: function (item,stack) {
if (item.type === "over") { if (item.type === "over")
TEX.Error(_("AmbiguousUseOf", "Ambiguous use of %1", item.name)) {TEX.Error(["AmbiguousUseOf","Ambiguous use of %1",item.name])}
}
if (item.isClose) { if (item.isClose) {
var mml = MML.mfrac(this.num,this.mmlData(false)); var mml = MML.mfrac(this.num,this.mmlData(false));
if (this.thickness != null) {mml.linethickness = this.thickness} if (this.thickness != null) {mml.linethickness = this.thickness}
@ -207,9 +195,7 @@
STACKITEM.left = STACKITEM.Subclass({ STACKITEM.left = STACKITEM.Subclass({
type: "left", isOpen: true, delim: '(', type: "left", isOpen: true, delim: '(',
// Localization: should be updated when the language is changed stopError: ["ExtraLeftMissingRight", "Extra \\left or missing \\right"],
// Add a note about the \\ syntax.
stopError: _("ExtraLeftMissingRight", "Extra \\left or missing \\right"),
checkItem: function (item) { checkItem: function (item) {
if (item.type === "right") { if (item.type === "right") {
var mml = MML.mfenced(this.data.length === 1 ? this.data[0] : MML.mrow.apply(MML,this.data)); var mml = MML.mfenced(this.data.length === 1 ? this.data[0] : MML.mrow.apply(MML,this.data));
@ -227,17 +213,13 @@
type: "begin", isOpen: true, type: "begin", isOpen: true,
checkItem: function (item) { checkItem: function (item) {
if (item.type === "end") { if (item.type === "end") {
if (item.name !== this.name) { if (item.name !== this.name)
TEX.Error(_("EnvBadEnd", {TEX.Error(["EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.name,item.name])}
"\\begin{%1} ended with \\end{%2}",
this.name, item.name))
}
if (!this.end) {return STACKITEM.mml(this.mmlData())} if (!this.end) {return STACKITEM.mml(this.mmlData())}
return this.parse[this.end].call(this.parse,this,this.data); return this.parse[this.end].call(this.parse,this,this.data);
} }
if (item.type === "stop") { if (item.type === "stop")
TEX.Error(_("EnvMissingEnd", "Missing \\end{%1}", this.name)) {TEX.Error(["EnvMissingEnd","Missing \\end{%1}",this.name])}
}
return this.SUPER(arguments).checkItem.call(this,item); return this.SUPER(arguments).checkItem.call(this,item);
} }
}); });
@ -258,9 +240,7 @@
STACKITEM.position = STACKITEM.Subclass({ STACKITEM.position = STACKITEM.Subclass({
type: "position", type: "position",
checkItem: function (item) { checkItem: function (item) {
if (item.isClose) { if (item.isClose) {TEX.Error(["MissingBoxFor","Missing box for %1"])}
TEX.Error(_("MissingBoxFor", "Missing box for %1"))
}
if (item.isNotStack) { if (item.isNotStack) {
var mml = item.mmlData(); var mml = item.mmlData();
switch (this.move) { switch (this.move) {
@ -302,7 +282,7 @@
mml = STACKITEM.mml(mml); mml = STACKITEM.mml(mml);
if (this.requireClose) { if (this.requireClose) {
if (item.type === 'close') {return mml} if (item.type === 'close') {return mml}
TEX.Error(_("MissingCloseBrace", "Missing close brace")); TEX.Error(["MissingCloseBrace","Missing close brace"]);
} }
return [mml,item]; return [mml,item];
} }
@ -1146,8 +1126,7 @@
// (overridden in noUndefined extension) // (overridden in noUndefined extension)
// //
csUndefined: function (name) { csUndefined: function (name) {
TEX.Error(_("UndefinedControlSequence", TEX.Error(["UndefinedControlSequence","Undefined control sequence %1",name]);
"Undefined control sequence %1", name));
}, },
/* /*
@ -1192,10 +1171,8 @@
else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}}
if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} if (base.isEmbellishedWrapper) {base = base.data[0].data[0]}
if (base.type === "msubsup") { if (base.type === "msubsup") {
if (base.data[base.sup]) { if (base.data[base.sup])
TEX.Error(_("DoubleExponent", {TEX.Error(["DoubleExponent","Double exponent: use braces to clarify"])}
"Double exponent: use braces to clarify"))
}
position = base.sup; position = base.sup;
} else if (base.movesupsub) { } else if (base.movesupsub) {
if (base.type !== "munderover" || base.data[base.over]) { if (base.type !== "munderover" || base.data[base.over]) {
@ -1217,10 +1194,8 @@
else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}}
if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} if (base.isEmbellishedWrapper) {base = base.data[0].data[0]}
if (base.type === "msubsup") { if (base.type === "msubsup") {
if (base.data[base.sub]) { if (base.data[base.sub])
TEX.Error(_("DoubleSubscripts", {TEX.Error(["DoubleSubscripts","Double subscripts: use braces to clarify"])}
"Double subscripts: use braces to clarify"))
}
position = base.sub; position = base.sub;
} else if (base.movesupsub) { } else if (base.movesupsub) {
if (base.type !== "munderover" || base.data[base.under]) { if (base.type !== "munderover" || base.data[base.under]) {
@ -1238,8 +1213,8 @@
Prime: function (c) { Prime: function (c) {
var base = this.stack.Prev(); if (!base) {base = MML.mi()} var base = this.stack.Prev(); if (!base) {base = MML.mi()}
if (base.type === "msubsup" && base.data[base.sup]) { if (base.type === "msubsup" && base.data[base.sup]) {
TEX.Error(_("DoubleExponentPrime", TEX.Error(["DoubleExponentPrime",
"Prime causes double exponent: use braces to clarify")) "Prime causes double exponent: use braces to clarify"]);
} }
var sup = ""; this.i--; var sup = ""; this.i--;
do {sup += this.PRIME; this.i++, c = this.GetNext()} do {sup += this.PRIME; this.i++, c = this.GetNext()}
@ -1267,8 +1242,8 @@
* Handle hash marks outside of definitions * Handle hash marks outside of definitions
*/ */
Hash: function (c) { Hash: function (c) {
TEX.Error(_("CantUseHash1", TEX.Error(["CantUseHash1",
"You can't use 'macro parameter character #' in math mode")); "You can't use 'macro parameter character #' in math mode"]);
}, },
/* /*
@ -1321,9 +1296,8 @@
Middle: function (name) { Middle: function (name) {
var delim = this.GetDelimiter(name); var delim = this.GetDelimiter(name);
if (this.stack.Top().type !== "left") { if (this.stack.Top().type !== "left")
TEX.Error(_("MisplacedMiddle", {TEX.Error(["MisplacedMiddle","%1 must be within \\left and \\right",name])}
"%1 must be within \\left and \\right", name))}
this.Push(MML.mo(delim).With({stretchy:true})); this.Push(MML.mo(delim).With({stretchy:true}));
}, },
@ -1346,10 +1320,8 @@
}, },
Limits: function (name,limits) { Limits: function (name,limits) {
var op = this.stack.Prev("nopop"); var op = this.stack.Prev("nopop");
if (!op || op.texClass !== MML.TEXCLASS.OP) { if (!op || op.texClass !== MML.TEXCLASS.OP)
TEX.Error(_("MisplacedLimits", {TEX.Error(["MisplacedLimits","%1 is allowed only on operators",name])}
"%1 is allowed only on operators", name))
}
op.movesupsub = (limits ? true : false); op.movesupsub = (limits ? true : false);
op.movablelimits = false; op.movablelimits = false;
}, },
@ -1398,18 +1370,13 @@
return n; return n;
}, },
MoveRoot: function (name,id) { MoveRoot: function (name,id) {
if (!this.stack.env.inRoot) { if (!this.stack.env.inRoot)
TEX.Error(_("BadMoveRoot", "%1 can appear only within a root")); {TEX.Error(["BadMoveRoot","%1 can appear only within a root"])}
} if (this.stack.global[id])
if (this.stack.global[id]) { {TEX.Error(["MultipleMoveRoot","Multiple use of %1",name])}
TEX.Error(_("MultipleMoveRoot",
"Multiple use of %1", name));
}
var n = this.GetArgument(name); var n = this.GetArgument(name);
if (!n.match(/-?[0-9]+/)) { if (!n.match(/-?[0-9]+/))
TEX.Error(_("IntegerArg", {TEX.Error(["IntegerArg","The argument to %1 must be an integer",name])}
"The argument to %1 must be an integer", name));
}
n = (n/15)+"em"; n = (n/15)+"em";
if (n.substr(0,1) !== "-") {n = "+"+n} if (n.substr(0,1) !== "-") {n = "+"+n}
this.stack.global[id] = n; this.stack.global[id] = n;
@ -1464,20 +1431,17 @@
attr = this.GetBrackets(name,"").replace(/^\s+/,""), attr = this.GetBrackets(name,"").replace(/^\s+/,""),
data = this.GetArgument(name), data = this.GetArgument(name),
def = {attrNames:[]}, match; def = {attrNames:[]}, match;
if (!MML[type] || !MML[type].prototype.isToken) { if (!MML[type] || !MML[type].prototype.isToken)
TEX.Error(_("NotMathMLToken", "%1 is not a token element", type)) {TEX.Error(["NotMathMLToken", "%1 is not a token element",type])}
}
while (attr !== "") { while (attr !== "") {
match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ]*)\s*/i); match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|\"[^"]*"|[^ ]*)\s*/i);
if (!match) { if (!match)
TEX.Error("InvalidMathMLAttr", {TEX.Error("InvalidMathMLAttr","Invalid MathML attribute: %1",attr)}
"Invalid MathML attribute: %1", attr)
}
if (!MML[type].prototype.defaults[match[1]] && if (!MML[type].prototype.defaults[match[1]] &&
!this.MmlTokenAllow[match[1]]) { !this.MmlTokenAllow[match[1]]) {
TEX.Error(_("UnknownAttrForElement", TEX.Error(["UnknownAttrForElement",
"%1 is not a recognized attribute for %2", "%1 is not a recognized attribute for %2",
match[1], type)) match[1],type]);
} }
def[match[1]] = match[2].replace(/^(['"])(.*)\1$/,"$2"); def[match[1]] = match[2].replace(/^(['"])(.*)\1$/,"$2");
def.attrNames.push(match[1]); def.attrNames.push(match[1]);
@ -1625,16 +1589,16 @@
this.string = this.AddArgs(macro,this.string.slice(this.i)); this.string = this.AddArgs(macro,this.string.slice(this.i));
this.i = 0; this.i = 0;
if (++this.macroCount > TEX.config.MAXMACROS) { if (++this.macroCount > TEX.config.MAXMACROS) {
TEX.Error(_("MaxMacroSub", TEX.Error(["MaxMacroSub",
"MathJax maximum macro substitution count exceeded; is there a recursive macro call?")) "MathJax maximum macro substitution count exceeded; " +
"is there a recursive macro call?"]);
} }
}, },
Matrix: function (name,open,close,align,spacing,vspacing,style,cases) { Matrix: function (name,open,close,align,spacing,vspacing,style,cases) {
var c = this.GetNext(); var c = this.GetNext();
if (c === "") { if (c === "")
TEX.Error(_("MissingArgFor", "Missing argument for %1", name)) {TEX.Error(["MissingArgFor","Missing argument for %1",name])}
}
if (c === "{") {this.i++} else {this.string = c+"}"+this.string.slice(this.i+1); this.i = 0} if (c === "{") {this.i++} else {this.string = c+"}"+this.string.slice(this.i+1); this.i = 0}
var array = STACKITEM.array().With({ var array = STACKITEM.array().With({
requireClose: true, requireClose: true,
@ -1660,8 +1624,7 @@
if (c === "{") {braces++; i++} if (c === "{") {braces++; i++}
else if (c === "}") {if (braces === 0) {m = 0} else {braces--; i++}} else if (c === "}") {if (braces === 0) {m = 0} else {braces--; i++}}
else if (c === "&" && braces === 0) { else if (c === "&" && braces === 0) {
TEX.Error(_("ExtraAlignTab", TEX.Error(["ExtraAlignTab","Extra alignment tab in \\cases text"]);
"Extra alignment tab in \\cases text"))
} else if (c === "\\") { } else if (c === "\\") {
if (string.substr(i).match(/^((\\cr)[^a-zA-Z]|\\\\)/)) {m = 0} else {i += 2} if (string.substr(i).match(/^((\\cr)[^a-zA-Z]|\\\\)/)) {m = 0} else {i += 2}
} else {i++} } else {i++}
@ -1684,8 +1647,8 @@
n = this.GetBrackets(name,"").replace(/ /g,""); n = this.GetBrackets(name,"").replace(/ /g,"");
if (n && if (n &&
!n.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) { !n.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) {
TEX.Error(_("BracketMustBeDimension", TEX.Error(["BracketMustBeDimension",
"Bracket argument to %1 must be a dimension", name)) "Bracket argument to %1 must be a dimension",name]);
} }
} }
this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true})); this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true}));
@ -1725,9 +1688,8 @@
HLine: function (name,style) { HLine: function (name,style) {
if (style == null) {style = "solid"} if (style == null) {style = "solid"}
var top = this.stack.Top(); var top = this.stack.Top();
if (!top.isa(STACKITEM.array) || top.data.length) { if (!top.isa(STACKITEM.array) || top.data.length)
TEX.Error(_("Misplaced", "Misplaced %1", name)) {TEX.Error(["Misplaced","Misplaced %1",name])}
}
if (top.table.length == 0) { if (top.table.length == 0) {
top.frame.push("top"); top.frame.push("top");
} else { } else {
@ -1745,18 +1707,15 @@
Begin: function (name) { Begin: function (name) {
var env = this.GetArgument(name); var env = this.GetArgument(name);
if (env.match(/[^a-z*]/i)) { if (env.match(/[^a-z*]/i))
TEX.Error(_("InvalidEnv", {TEX.Error(["InvalidEnv","Invalid environment name '%1'",env])}
"Invalid environment name '%1'", env))
}
var cmd = this.envFindName(env); var cmd = this.envFindName(env);
if (!cmd) { if (!cmd)
TEX.Error(_("UnknownEnv", {TEX.Error(["UnknownEnv","Unknown environment '%1'",env])}
"Unknown environment '%1'", env))
}
if (++this.macroCount > TEX.config.MAXMACROS) { if (++this.macroCount > TEX.config.MAXMACROS) {
TEX.Error(_("MaxMacroSub2", TEX.Error(["MaxMacroSub2",
"MathJax maximum substitution count exceeded; is there a recursive latex environment?")) "MathJax maximum substitution count exceeded; " +
"is there a recursive latex environment?"]);
} }
if (!(cmd instanceof Array)) {cmd = [cmd]} if (!(cmd instanceof Array)) {cmd = [cmd]}
var mml = STACKITEM.begin().With({name: env, end: cmd[1], parse:this}); var mml = STACKITEM.begin().With({name: env, end: cmd[1], parse:this});
@ -1867,14 +1826,12 @@
GetArgument: function (name,noneOK) { GetArgument: function (name,noneOK) {
switch (this.GetNext()) { switch (this.GetNext()) {
case "": case "":
if (!noneOK) { if (!noneOK) {TEX.Error(["MissingArgFor","Missing argument for %1",name])}
TEX.Error(_("MissingArgFor", "Missing argument for %1", name))
}
return null; return null;
case '}': case '}':
if (!noneOK) { if (!noneOK) {
TEX.Error(_("ExtraCloseMissingOpen", TEX.Error(["ExtraCloseMissingOpen",
"Extra close brace or missing open brace")) "Extra close brace or missing open brace"]);
} }
return null; return null;
case '\\': case '\\':
@ -1886,14 +1843,12 @@
case '\\': this.i++; break; case '\\': this.i++; break;
case '{': parens++; break; case '{': parens++; break;
case '}': case '}':
if (parens == 0) { if (parens == 0) {TEX.Error(["ExtraClose","Extra close brace"])}
TEX.Error(_("ExtraClose", "Extra close brace"))
}
if (--parens == 0) {return this.string.slice(j,this.i-1)} if (--parens == 0) {return this.string.slice(j,this.i-1)}
break; break;
} }
} }
TEX.Error(_("MissingCloseBrace", "Missing close brace")); TEX.Error(["MissingCloseBrace","Missing close brace"]);
break; break;
} }
return this.string.charAt(this.i++); return this.string.charAt(this.i++);
@ -1911,8 +1866,8 @@
case '\\': this.i++; break; case '\\': this.i++; break;
case '}': case '}':
if (parens-- <= 0) { if (parens-- <= 0) {
TEX.Error(_("ExtraCloseInBrackets", TEX.Error(["ExtraCloseBrace",
"Extra close brace while looking for ']'")) "Extra close brace while looking for %1","']'"]);
} }
break; break;
case ']': case ']':
@ -1920,9 +1875,8 @@
break; break;
} }
} }
TEX.Error( TEX.Error(["MissingCloseBracket",
_("MissingCloseBracket", "Couldn't find closing ']' for argument to %1",name]);
"Couldn't find closing ']' for argument to %1", name));
}, },
/* /*
@ -1935,8 +1889,8 @@
this.i++; if (c == "\\") {c += this.GetCS(name)} this.i++; if (c == "\\") {c += this.GetCS(name)}
if (TEXDEF.delimiter[c] != null) {return this.convertDelimiter(c)} if (TEXDEF.delimiter[c] != null) {return this.convertDelimiter(c)}
} }
TEX.Error(_("MissingOrUnrecognizedDelim", TEX.Error(["MissingOrUnrecognizedDelim",
"Missing or unrecognized delimiter for %1", name)); "Missing or unrecognized delimiter for %1",name]);
}, },
/* /*
@ -1957,8 +1911,8 @@
return match[1].replace(/ /g,""); return match[1].replace(/ /g,"");
} }
} }
TEX.Error(_("MissingDimOrUnits", TEX.Error(["MissingDimOrUnits",
"Missing dimension or its units for %1", name)); "Missing dimension or its units for %1",name]);
}, },
/* /*
@ -1974,16 +1928,16 @@
case '{': parens++; break; case '{': parens++; break;
case '}': case '}':
if (parens == 0) { if (parens == 0) {
TEX.Error(_("ExtraCloseBraceInUpTo", TEX.Error(["ExtraCloseBrace",
"Extra close brace while looking for %1", token)) "Extra close brace while looking for %1",token])
} }
parens--; parens--;
break; break;
} }
if (parens == 0 && c == token) {return this.string.slice(j,k)} if (parens == 0 && c == token) {return this.string.slice(j,k)}
} }
TEX.Error(_("TokenNotFoundForCommand", TEX.Error(["TokenNotFoundForCommand",
"Couldn't find %1 for %2", token, name)); "Couldn't find %1 for %2",token,name]);
}, },
/* /*
@ -2032,9 +1986,8 @@
} }
} }
} }
if (match !== '') { if (match !== '')
TEX.Error(_("MathNotTerminated", "Math not terminated in text box")) {TEX.Error(["MathNotTerminated","Math not terminated in text box"])}
}
if (k < text.length) {mml.push(this.InternalText(text.slice(k),def))} if (k < text.length) {mml.push(this.InternalText(text.slice(k),def))}
return mml; return mml;
}, },
@ -2055,8 +2008,8 @@
c = string.charAt(i++); c = string.charAt(i++);
if (c === '#') {text += c} else { if (c === '#') {text += c} else {
if (!c.match(/[1-9]/) || c > args.length) { if (!c.match(/[1-9]/) || c > args.length) {
TEX.Error(_("IllegalMacroParam", TEX.Error(["IllegalMacroParam",
"Illegal macro parameter reference")) "Illegal macro parameter reference"]);
} }
newstring = this.AddArgs(this.AddArgs(newstring,text),args[c-1]); newstring = this.AddArgs(this.AddArgs(newstring,text),args[c-1]);
text = ''; text = '';
@ -2073,8 +2026,8 @@
AddArgs: function (s1,s2) { AddArgs: function (s1,s2) {
if (s2.match(/^[a-z]/i) && s1.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)) {s1 += ' '} if (s2.match(/^[a-z]/i) && s1.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)) {s1 += ' '}
if (s1.length + s2.length > TEX.config.MAXBUFFER) { if (s1.length + s2.length > TEX.config.MAXBUFFER) {
TEX.Error(_("MaxBufferSize", TEX.Error(["MaxBufferSize",
"MathJax internal buffer size exceeded; is there a recursive macro call?")) "MathJax internal buffer size exceeded; is there a recursive macro call?"]);
} }
return s1+s2; return s1+s2;
} }
@ -2091,7 +2044,7 @@
MAXBUFFER: 5*1024 // maximum size of TeX string to process MAXBUFFER: 5*1024 // maximum size of TeX string to process
}, },
sourceMenuTitle: "TeX Commands", sourceMenuTitle: /*_(MathMenu)*/ ["TeXCommands","TeX Commands"],
prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX
postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX
@ -2147,6 +2100,10 @@
// Produce an error and stop processing this equation // Produce an error and stop processing this equation
// //
Error: function (message) { Error: function (message) {
//
// Translate message if it is ["id","message",args]
//
if (message instanceof Array) {message = _.apply(_,message)}
throw HUB.Insert(Error(message),{texError: true}); throw HUB.Insert(Error(message),{texError: true});
}, },

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/jax/output/HTML-CSS/autoload/mglyph.js * MathJax/jax/output/HTML-CSS/autoload/mglyph.js
@ -24,9 +25,10 @@
*/ */
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var VERSION = "2.1"; var VERSION = "2.1.1";
var MML = MathJax.ElementJax.mml, var MML = MathJax.ElementJax.mml,
HTMLCSS = MathJax.OutputJax["HTML-CSS"]; HTMLCSS = MathJax.OutputJax["HTML-CSS"],
LOCALE = MathJax.Localization;
MML.mglyph.Augment({ MML.mglyph.Augment({
toHTML: function (span,variant) { toHTML: function (span,variant) {
@ -41,11 +43,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
if (HTMLCSS.Font.testFont(font)) { if (HTMLCSS.Font.testFont(font)) {
this.HTMLhandleVariant(span,variant,String.fromCharCode(index)); this.HTMLhandleVariant(span,variant,String.fromCharCode(index));
} else { } else {
if (values.alt === "") { if (values.alt === "")
values.alt = {values.alt = LOCALE._(["MathML","BadMglyphFont"],"Bad font: %1",font.family)}
MathJax.Localization._(["MathML", "BadMglyphFont"],
"Bad font: %1", font.family);
}
err = MML.merror(values.alt).With({mathsize:"75%"}); err = MML.merror(values.alt).With({mathsize:"75%"});
this.Append(err); err.toHTML(span); this.data.pop(); this.Append(err); err.toHTML(span); this.data.pop();
span.bbox = err.HTMLspanElement().bbox; span.bbox = err.HTMLspanElement().bbox;
@ -64,8 +63,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
} }
if (this.img.status !== "OK") { if (this.img.status !== "OK") {
err = MML.merror( err = MML.merror(
MathJax.Localization._(["MathML", "BadMglyph"], LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
"Bad mglyph: %1", values.src)
).With({mathsize:"75%"}); ).With({mathsize:"75%"});
this.Append(err); err.toHTML(span); this.data.pop(); this.Append(err); err.toHTML(span); this.data.pop();
span.bbox = err.HTMLspanElement().bbox; span.bbox = err.HTMLspanElement().bbox;

View File

@ -26,7 +26,7 @@
MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({ MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({
id: "HTML-CSS", id: "HTML-CSS",
version: "2.1", version: "2.1.1",
directory: MathJax.OutputJax.directory + "/HTML-CSS", directory: MathJax.OutputJax.directory + "/HTML-CSS",
extensionDir: MathJax.OutputJax.extensionDir + "/HTML-CSS", extensionDir: MathJax.OutputJax.extensionDir + "/HTML-CSS",
autoloadDir: MathJax.OutputJax.directory + "/HTML-CSS/autoload", autoloadDir: MathJax.OutputJax.directory + "/HTML-CSS/autoload",
@ -147,10 +147,8 @@ MathJax.Hub.Register.StartupHook("End Config",[function (HUB,HTMLCSS) {
!HUB.Browser.versionAtLeast(CONFIG.minBrowserVersion[HUB.Browser]||0.0)) { !HUB.Browser.versionAtLeast(CONFIG.minBrowserVersion[HUB.Browser]||0.0)) {
HTMLCSS.Translate = CONFIG.minBrowserTranslate; HTMLCSS.Translate = CONFIG.minBrowserTranslate;
HUB.Config({showProcessingMessages: false}); HUB.Config({showProcessingMessages: false});
MathJax.Message.Set( MathJax.Message.Set(["MathJaxNotSupported",
MathJax.Localization._(["Message", "MathJaxNotSupported"], "Your browser does not support MathJax"],null,4000);
"Your browser does not support MathJax"),
null,4000);
HUB.Startup.signal.Post("MathJax not supported"); HUB.Startup.signal.Post("MathJax not supported");
} }

View File

@ -29,6 +29,12 @@
(function (AJAX,HUB,HTMLCSS) { (function (AJAX,HUB,HTMLCSS) {
var MML, isMobile = HUB.Browser.isMobile; var MML, isMobile = HUB.Browser.isMobile;
var MESSAGE = function () {
var data = [].slice.call(arguments,0);
data[0][0] = ["HTML-CSS",data[0][0]];
return MathJax.Message.Set.apply(MathJax.Message,data);
};
var FONTTEST = MathJax.Object.Subclass({ var FONTTEST = MathJax.Object.Subclass({
timeout: (isMobile? 15:8)*1000, // timeout for loading web fonts timeout: (isMobile? 15:8)*1000, // timeout for loading web fonts
@ -131,12 +137,7 @@
loadWebFont: function (font) { loadWebFont: function (font) {
HUB.Startup.signal.Post("HTML-CSS Jax - Web-Font "+HTMLCSS.fontInUse+"/"+font.directory); HUB.Startup.signal.Post("HTML-CSS Jax - Web-Font "+HTMLCSS.fontInUse+"/"+font.directory);
var n = MathJax.Message.File( var n = MESSAGE(["LoadWebFont","Loading webfont %1",HTMLCSS.fontInUse+"/"+font.directory]);
// Localization: Message.File(fileName) will write "Loading "+fileName
// Here, this will become "Loading Web-Font "+fileName. Does it work
// for all languages (word order might be different)?
"Web-Font "+HTMLCSS.fontInUse+"/"+font.directory
);
var done = MathJax.Callback({}); // called when font is loaded var done = MathJax.Callback({}); // called when font is loaded
var callback = MathJax.Callback(["loadComplete",this,font,n,done]); var callback = MathJax.Callback(["loadComplete",this,font,n,done]);
AJAX.timer.start(AJAX,[this.checkWebFont,font,callback],0,this.timeout); AJAX.timer.start(AJAX,[this.checkWebFont,font,callback],0,this.timeout);
@ -156,17 +157,11 @@
if (!this.webFontLoaded) {HTMLCSS.loadWebFontError(font,done)} else {done()} if (!this.webFontLoaded) {HTMLCSS.loadWebFontError(font,done)} else {done()}
}, },
loadError: function (font) { loadError: function (font) {
MathJax.Message.Set( MESSAGE(["CantLoadWebFont","Can't load web font %1",HTMLCSS.fontInUse+"/"+font.directory],null,2000);
MathJax.Localization._("Message", "CantLoadWebFont",
"Can't load web font %1", HTMLCSS.fontInUse+"/"+font.directory),
null,2000);
HUB.Startup.signal.Post(["HTML-CSS Jax - web font error",HTMLCSS.fontInUse+"/"+font.directory,font]); HUB.Startup.signal.Post(["HTML-CSS Jax - web font error",HTMLCSS.fontInUse+"/"+font.directory,font]);
}, },
firefoxFontError: function (font) { firefoxFontError: function (font) {
MathJax.Message.Set( MESSAGE(["FirefoxCantLoadWebFont","Firefox can't load web fonts from a remote host"],null,3000);
MathJax.Localization._(["Message", "FirefoxCantLoadWebFont"],
"Firefox can't load web fonts from a remote host"),
null,3000);
HUB.Startup.signal.Post("HTML-CSS Jax - Firefox web fonts on remote host error"); HUB.Startup.signal.Post("HTML-CSS Jax - Firefox web fonts on remote host error");
}, },
@ -334,11 +329,8 @@
HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts"); HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts");
} }
} else { } else {
MathJax.Message.Set( MESSAGE(["CantFindFontUsing","Can't find a valid font using %1",
MathJax.Localization._(["Message", "CantFindFontUsing"], "["+this.config.availableFonts.join(", ")+"]"],null,3000);
"Can't find a valid font using %1",
"["+this.config.availableFonts.join(", ")+"]"),
null,3000);
this.FONTDATA = { this.FONTDATA = {
TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8, TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8,
FONTS: {}, VARIANT: {normal: {fonts:[]}}, RANGES: [], FONTS: {}, VARIANT: {normal: {fonts:[]}}, RANGES: [],
@ -1486,10 +1478,7 @@
this.imgFonts = true; this.imgFonts = true;
HUB.Startup.signal.Post("HTML-CSS Jax - switch to image fonts"); HUB.Startup.signal.Post("HTML-CSS Jax - switch to image fonts");
HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts"); HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts");
MathJax.Message.Set( MESSAGE(["WebFontNotAvailable","Web-Fonts not available -- using image fonts instead"],null,3000);
MathJax.Localization._(["Message", "WebFontNotAvailable"],
"Web-Fonts not available -- using image fonts instead"),
null,3000);
AJAX.Require(this.directory+"/imageFonts.js",done); AJAX.Require(this.directory+"/imageFonts.js",done);
} else { } else {
this.allowWebFonts = false; this.allowWebFonts = false;

View File

@ -1,5 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */ /* vim: set ts=2 et sw=2 tw=80: */
/************************************************************* /*************************************************************
* *
* MathJax/jax/output/SVG/autoload/mglyph.js * MathJax/jax/output/SVG/autoload/mglyph.js
@ -27,7 +28,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var VERSION = "2.1"; var VERSION = "2.1";
var MML = MathJax.ElementJax.mml, var MML = MathJax.ElementJax.mml,
SVG = MathJax.OutputJax.SVG, SVG = MathJax.OutputJax.SVG,
BBOX = SVG.BBOX; BBOX = SVG.BBOX,
LOCALE = MathJax.Localization;
var XLINKNS = "http://www.w3.org/1999/xlink"; var XLINKNS = "http://www.w3.org/1999/xlink";
@ -73,8 +75,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
} }
if (this.img.status !== "OK") { if (this.img.status !== "OK") {
err = MML.merror( err = MML.merror(
MathJax.Localization._(["MathML", "BadMglyph"], LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src)
"Bad mglyph: %1", values.src)
).With({mathsize:"75%"}); ).With({mathsize:"75%"});
this.Append(err); svg = err.toSVG(); this.data.pop(); this.Append(err); svg = err.toSVG(); this.data.pop();
} else { } else {

View File

@ -0,0 +1,53 @@
MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
FontWarnings: {
isLoaded: true,
strings: {
webFont:
"MathJax utilise les polices Web pour afficher les expressions " +
"mathématiques sur cette page. Celles-ci mettent du temps à être "+
"téléchargées et la page serait affichée plus rapidement si vous "+
"installiez les polices mathématiques directement dans le dossier "+
"des polices de votre système.",
imageFonts:
"MathJax utilise des images de caractères plutôt que les polices "+
"Web ou locales. Ceci rend le rendu plus lent que la normale et "+
"les expressions mathématiques peuvent ne pas s'imprimer à la "+
"résolution maximale de votre imprimante",
noFonts:
"MathJax n'est pas parvenu à localiser une police pour afficher "+
"les expressions mathématiques et les images de caractères ne "+
"sont pas disponibles. Comme solution de dernier recours, il "+
"utilise des caractères Unicode génériques en espérant que votre "+
"navigateur sera capable de les afficher. Certains pourront ne "+
"être rendus de façon incorrect voire pas du tout.",
webFonts:
"La plupart des navigateurs modernes permettent de télécharger "+
"des polices à partir du Web. En mettant à jour pour une version "+
"plus récente de votre navigateur (ou en changeant de navigateur) "+
"la qualité des expressions mathématiques sur cette page pourrait "+
"être améliorée.",
fonts:
"%1 MathJax peut utiliser les %2 ou bien les %3. Téléchargez et"+
"installez l'une de ces familles de polices pour améliorer votre"+
"expérience avec MathJax.",
PageDesigned:
"%1 Cette page est conçue pour utiliser les %2. Téléchargez "+
" et installez ces polices pour améliorer votre expérience "+
"avec MathJax",
STIXfonts:
"Polices STIX",
TeXfonts:
"Polices TeX de MathJax"
}
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/fr/FontWarnings.js");

View File

@ -0,0 +1,49 @@
MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
MathML: {
isLoaded: true,
strings: {
BadMglyph:
"Élement mglyph incorrect: %1",
BadMglyphFont:
"Police de caractère incorrecte: %1",
MathPlayer:
"MathJax n'est pas parvenu à configurer MathPlayer.\n\n"+
"Vous devez d'abord installer MathPlayer. Si c'est déjà le cas,\n"+
"vos paramètres de sécurités peuvent empêcher l'exécution des\n"+
"contrôles ActiveX. Sélectionnez Options Internet dans le menu\n"+
"Outils et sélectionnez l'onglet Sécurité. Appuyez ensuite sur\n"+
"le menu Niveau Personalisé. Assurez vous que les paramètres\n"+
"Exécution des contrôles ActiveX et Comportements des exécutables\n"+
"et des scripts sont activés.\n\n"+
"Actuellement, vous verez des messages d'erreur à la place des\n"+
"expressions mathématiques.",
CantCreateXMLParser:
"MathJax ne peut créer un analyseur grammatical XML pour le MathML",
UnknownNodeType:
"Type de noeud inconnu: %1",
UnexpectedTextNode:
"Noeud de texte inattendu: %1",
ErrorParsingMathML:
"Erreur lors de l'analyse grammaticale du code MathML",
ParsingError:
"Erreur lors de l'analyse du code MathML: %1",
MathMLSingleElement:
"Le code MathML doit être formé d'un unique élément",
MathMLRootElement:
"Le code MathML doit être formé d'un élément <math> et non un élément %1"
}
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/fr/MathML.js");

View File

@ -0,0 +1,118 @@
MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
MathMenu: {
isLoaded: true,
strings: {
Show: "Voir Maths Comme",
MathMLcode: "du Code MathML",
OriginalMathML: "d'Origine MathML",
TeXCommands: "Commandes TeX",
AsciiMathInput: "AsciiMathml Entrée",
Original: "Forme Originale",
ErrorMessage: "Message d'Erreur",
texHints: "Voir les notes TeX dans MathML",
Settings: "Paramètres Maths",
ZoomTrigger: "Trigger Zoom",
Hover: "Flotter",
Click: "Clic de Souris",
DoubleClick: "Double-Clic",
NoZoom: "Pas de Zoom",
TriggerRequires: "Trigger Nécessite",
Option: "Option",
Alt: "Alt",
Command: "Command",
Control: "Control",
Shift: "Shift",
ZoomFactor: "Facteur de Zoom",
Renderer: "Traduire Maths",
MPHandles: "Laissez MathPlayer Gérer:",
MenuEvents: "Sélections du menu",
MouseEvents: "Êvénements de la Souris",
MenuAndMouse: "Les Êvénements de Menu et de la Souris",
FontPrefs: "Préférences des Polices",
ForHTMLCSS: "Pour le HTML-CSS:",
Auto: "Auto",
TeXLocal: "TeX (local)",
TeXWeb: "TeX (web)",
TeXImage: "TeX (image)",
STIXLocal: "STIX (local)",
ContextMenu: "Menu Contextuel",
Browser: "Navigateur",
Scale: "Ajuster tous les Maths ...",
Discoverable: "Mettez en Surbrillance lors de Survol",
About: "À propos de MathJax",
Help: "Aide MathJax",
localTeXfonts: "utilisant les polices locales TeX",
webTeXfonts: "utilisant les polices internet TeX",
imagefonts: "utilisant les polices d'image",
localSTIXfonts: "utilisant les polices locales STIX",
webSVGfonts: "utilisant les polices internet SVG",
genericfonts: "utilisant les polices locales génériques",
wofforotffonts: "les polices woff ou otf",
eotffonts: "les polices eot",
svgfonts: "les polices svg",
WebkitNativeMMLWarning:
"Votre navigateur ne semble pas comporter de support MathML, " +
"changer le mode de rendu pourrait rendre illisibles " +
"les expressions mathématiques.",
MSIENativeMMLWarning:
"Internet Explorer a besoin de module complémentaire MathPlayer " +
"pour afficher le MathML.",
OperaNativeMMLWarning:
"Le support MathML d'Opera est limité, changer le mode de rendu " +
"pourrait entrainer un affichage médiocre de certaines expressions.",
SafariNativeMMLWarning:
"Le support MathML natif de votre navigateur ne comporte pas " +
"toutes les fonctionnalités requises par MathJax, certaines " +
"expressions pourront donc ne pas s'afficher correctement.",
FirefoxNativeMMLWarning:
"Le support MathML natif de votre navigateur ne comporte pas " +
"toutes les fonctionnalités requises par MathJax, certaines " +
"expressions pourront donc ne pas s'afficher correctement.",
SwitchAnyway:
"Êtes vous certain de vouloir changer le mode de rendu ?\n\n" +
"Appuyez sur OK pour valider ou Annuler pour continuer avec le " +
"mode de rendu actuellement sélectionné.",
ScaleMath:
"Mise à l'échelle des expressions mathématiques (par rapport au " +
"text environnant) de %1%%",
NonZeroScale:
"L'échelle ne peut être nulle",
PercentScale:
"L'échelle doit être un pourcentage (e.g. 120%%)",
IE8warning:
"Ceci désactivera le menu de MathJax et les fonctionalités de " +
"zoom mais vous pourrez toujours obtenir le menu de MathJax " +
"en utilisant la commande Alt+Clic sur une expression.\n\n" +
"Êtes vous certain de vouloir choisir les options de MathPlayer?",
IE9warning:
"Le menu contextuel de MathJax sera désactivé, " +
"mais vous pourrez toujours obtenir le menu de MathJax " +
"en utilisant la commande Alt-Clic sur une expression.",
NoOriginalForm:
"Aucune forme d'origine disponible.",
Close:
"Fermer",
EqSource:
"Source de l'équation MathJax"
}
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/fr/MathMenu.js");

View File

@ -0,0 +1,254 @@
MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
TeX: {
isLoaded: true,
strings: {
ExtraOpenMissingClose:
"Accolade ouvrant manquante ou accolade fermante non attendue",
ExtraCloseMissingOpen:
"Accolade fermante non attendue ou accolade ouvrante manquante",
MissingLeftExtraRight:
"Commande \\left manquante or ou commande \\right non attendue",
MissingScript:
"Argument en exposant ou en indice manquant",
ExtraLeftMissingRight:
"Commande \\left inattendue or ou commande \\right manquante",
Misplaced:
"Mauvaise position pour la commande %1",
MissingOpenForScript:
"Accolade ouvrante manquante pour le script %1",
AmbiguousUseOf:
"Usage ambigu de la commande %1",
EnvBadEnd:
"\\begin{%1} s'est terminé par un \\end{%2}",
EnvMissingEnd:
"\\end{%1} manquant",
MissingBoxFor:
"Boite manquante pour la commande %1",
MissingCloseBrace:
"Accolade fermante manquante",
UndefinedControlSequence:
"Commande %1 non définie",
IllegalControlSequenceName:
"Nom de contrôle de séquence non autorisé pour la commande %1",
IllegalParamNumber:
"Nombre de paramètres incorrect pour la commande %1",
DoubleExponent:
"Double exposant: utilisez des accolades pour clarifier",
DoubleSubscripts:
"Double indice: utilisez des accolades pour clarifier",
DoubleExponentPrime:
"Un prime entraine un double exposant: utilisez "+
"des accolades pour clarifier",
CantUseHash1:
"Vous ne pouvez pas utilisez le caractère #, indiquant un "+
"paramètre de macro, dans le mode mathématique",
CantUseHash2:
"Usage du caractère # non autorisé dans le modèle pour la séquence "+
"de contrôle %1",
MisplacedMiddle:
"La commande %1 doit être placée à l'intérieur d'une section "+
"\\left ... \right",
MisplacedLimits:
"La commande %1 n'est autorisée que sur les opérateurs",
MisplacedMoveRoot:
"La commande %1 n'est autorisée qu'à l'intérieur d'une racine",
MultipleMoveRoot:
"Commande %1 redondante",
IntegerArg:
"L'argument de la commande %1 doit être un entier",
PositiveIntegerArg:
"L'argument de la commande %1 doit être un entier strictement "+
"positif",
NotMathMLToken:
"L'élément %1 n'est pas un élément MathML élémentaire",
InvalidMathMLAttr:
"Attribut MathML non valide: %1",
UnknownAttrForElement:
"Attribut %1 inconnu pour l'élément %2",
MaxMacroSub1:
"Le nombre maximal de substitution de macro autorisé par MathJax "+
"a été dépassé. Il y a t'il un appel de macro récursif?",
MaxMacroSub2:
"Le nombre maximal de substitution de macro autorisé par MathJax "+
"a été dépassé. Il y a t'il un environnement LaTeX récursif?",
MissingArgFor:
"Argument manquant pour la commande %1",
ExtraAlignTab:
"Tabulation d'alignement non attendu pour le texte de la commande "+
"\\cases",
BracketMustBeDimension:
"L'argument entre crochets de la commande %1 doit être une "+
"dimension",
InvalidEnv:
"Nom d'environnement '%1' non valide",
UnknownEnv:
"Environnement '%1' inconnu",
ExtraClose:
"Accolade fermante non attendue",
ExtraCloseInBrackets:
"Accolade fermante non attendue avant le crochet fermant.",
MissingCloseBracket:
"Impossible de trouver le crochet fermant pour l'argument de la "+
"commande %1",
MissingOrUnrecognizedDelim:
"Délimiteur manquant ou non reconnu pour la commande %1",
MissingDimOrUnits:
"Dimension ou unité manquante pour la commande %1",
ExtraCloseBraceInUpTo:
"Accolade fermante non attendue avant la commande %1",
TokenNotFoundForCommand:
"Impossible de trouver la commande %1 pour la commande %2",
MathNotTerminated:
"Expression mathématique non terminée à l'intérieur de cette boite "+
"de texte",
IllegalMacroParam:
"Paramètre de référence de macro non autorisé",
MaxBufferSize:
"Taille maximale du tampon interne de MathJax dépassée. " +
"Il y a t'il un appel de macro récursif?",
CommandNotAllowedInEnv:
"La commande %1 n'est pas autorisé à l'intérieur de "+
"l'environnement %2",
MultipleCommand:
"Usage multiple de la commande %1",
MultipleLabel:
"Étiquette '%1' déjà définie",
CommandAtTheBeginingOfLine:
"La commande %1 doit être placée en début de ligne",
IllegalAlign:
"Alignement non autorisé pour la commande %1",
BadMathStyleFor:
"Style mathématique non valide pour la commande %1",
ErroneousNestingEq:
"Emboitement incorrect des structures d'équation",
MultipleRowsOneCol:
"Les lignes multiples doivent avoir exactement une colonne",
NoClosingDelim:
"Impossible de trouver le délimiteur fermant pour la commande %1",
NoClosingChar:
"Impossible de trouver le délimiteur '%1' fermant",
MultipleBBoxProperty:
"La propriété %1 de la commande %2 spécifiée deux fois",
InvalidBBoxProperty:
"La valeur '%1' ne semble pas être une couleur, une dimension ou "+
"de marge intérieur ou un style.",
ExtraEndMissingBegin:
"Commande %1 non attendue ou commande \\begingroup manquante",
GlobalNotFollowedBy:
"Command %1 non suivie d'une commande \\let, \\def ou \newcommand",
NewextarrowArg1:
"Le premier argument de la commande %1 doit être le nom d'une "+
"séquence de contrôle",
NewextarrowArg2:
"Le second argument de la commande %1 doit être deux entiers "+
"séparés par une virgule",
NewextarrowArg3:
"Le troisième argument de la commande %1 doit être la valeur d'un "+
"caractère unicode",
UndefinedColorModel:
"Le modèle de couleur '%1' n'est pas défini",
rgbArg1:
"Les couleurs rgb nécéssitent 3 nombres décimaux",
InvalidDecimalNumber:
"Nombre décimal non valide",
rgbArg2:
"Les valeurs rgb doivent être comprises entre 0 et 1",
RGBArg1:
"Les couleurs RGB nécéssitent 3 nombres",
InvalidNumber:
"Nombre non valide",
RGBArg2:
"Les valeurs RGB doivent être comprises entre 0 et 255",
GrayScalerArg:
"Les valeurs de dégradé de gris doivent être comprises entre 0 et 1",
DoubleBackSlash:
"\\ doit être suivi d'une séquence de contrôle",
SequentialParam:
"Les paramètres de la séquence de contrôle %1 doivent être "+
"énumérés de façon séquentielle",
MissingReplacementString:
"Chaine de caractère de remplacement manquante pour la définition %1",
MismatchUseDef:
"L'utilisation de la commande %1 ne correspond pas à sa définition",
RunawayArgument:
"Argument manquant pour la commande %1?"
}
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/fr/TeX.js");

View File

@ -0,0 +1,72 @@
MathJax.Hub.Insert(MathJax.Localization.strings.fr,{
isLoaded: true,
domains: {
"_": {
isLoaded: true,
strings: {
CookieConfig:
"MathJax a trouvé un cookie de configuration utilisateur qui inclut"+
"du code à exécuter. Souhaitez vous l'exécuter?\n\n"+
"(Choisissez Annuler sauf si vous avez créé ce cookie vous-même",
MathProcessingError:
"Erreur de traitement de la formule mathématique",
MathProcessingErrorHTML:
["[Erreur de traitement de la formule mathématique]"],
MathErrorHTML:
["[Erreur dans la formule mathématique]"],
LoadFile: "Téléchargement %1",
Loading: "Téléchargement",
LoadFailed: "Échec du téléchargement de %1",
CantLoadWebFont: "Impossible de télécharcharger la police Web %1",
ProcessMath: "Traitement des maths: %1%%",
Processing: "Traitement",
TypesetMath: "Composition des maths: %1%%",
Typesetting: "Composition",
FirefoxCantLoadWebFont:
"Firefox ne peut télécharger les polices Web à partir d'un hôte"+
"distant",
CantFindFontUsing:
"Impossible de trouver une police valide en utilisant %1",
WebFontsNotAvailable:
"Polices Web non disponibles -- des images de caractères vont être"+
"utilisées à la place",
MathJaxNotSupported:
"Votre navigateur ne supporte pas MathJax"
}
},
MathMenu: {},
FontWarnings: {},
"v1.0-warning": {},
TeX: {},
MathML: {}
},
plural: function(n) {
if (0 <= n && n < 2) {return 1} // one
return 2; // other
},
number: function(n) {
return n.replace(".", ","); // replace dot by comma
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/fr/fr.js");

View File

@ -0,0 +1,15 @@
MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{
"v1.0-warning": {
isLoaded: true,
strings: {
MissingConfig:
"%1 MathJax ne charge plus de fichier de configuration par défaut; "+
"vous devez spécifier ces fichiers de façons explicites. Cette "+
"page semble utiliser l'ancien fichier de configuration par "+
"défaut %2 and doit donc être mise à jour. Ceci est expliqué "+
"en détails à l'addresse suivante: %3"
}
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/fr/v1.0-warning.js");