Bring AsciiMath up to version 2.0.1 (by modifying two lines in the 1.4.7 version)

This commit is contained in:
Davide P. Cervone 2012-02-26 07:41:44 -05:00
parent 4d61d199ca
commit 3f415603d8
6 changed files with 20 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -171,6 +171,7 @@
var navigator = {appName: "MathJax"}; // hide the true navigator object var navigator = {appName: "MathJax"}; // hide the true navigator object
var i; // avoid global variable used in code below
/****************************************************************** /******************************************************************
* *
@ -182,6 +183,11 @@
* A few items are commented out and marked with DPVC comments * A few items are commented out and marked with DPVC comments
* in order to keep the minifier from complaining about the * in order to keep the minifier from complaining about the
* coding practices in ASCIIMathML.js * coding practices in ASCIIMathML.js
*
* Two sections are modified to include changes from version 2.0.1 of
* ASCIIMathML.js and are marked with comments to that effect. This
* makes this version effectively the same as version 2.0.1, but
* without the overhead of the LaTeX-processing code.
* *
******************************************************************/ ******************************************************************/
@ -542,6 +548,10 @@ function AMcreateMmlNode(t,frag) {
function newcommand(oldstr,newstr) { function newcommand(oldstr,newstr) {
AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr, AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
tex:null, ttype:DEFINITION}]); tex:null, ttype:DEFINITION}]);
// #### Added from Version 2.0.1 #### //
AMsymbols.sort(compareNames);
for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
// #### End of Addition #### //
} }
function AMremoveCharsAndBlanks(str,n) { function AMremoveCharsAndBlanks(str,n) {
@ -625,8 +635,12 @@ function AMgetSymbol(str) {
st = str.slice(0,1); //take 1 character st = str.slice(0,1); //take 1 character
tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
} }
if (st=="-" && AMpreviousSymbol==INFIX) // #### Replaced by lines from Version 2.0.1 #### //
if (st=="-" && AMpreviousSymbol==INFIX) {
AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
}
// #### End of Replacement #### //
return {input:st, tag:tagst, output:st, ttype:CONST}; return {input:st, tag:tagst, output:st, ttype:CONST};
} }