Merge pull request #1606 from dpvc/issue1605
Update AsciiMath to include changes since v2.6. #1605
This commit is contained in:
commit
351616984b
|
@ -382,12 +382,13 @@ function createMmlNode(t,frag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function newcommand(oldstr,newstr) {
|
function newcommand(oldstr,newstr) {
|
||||||
AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
|
AMsymbols.push({input:oldstr, tag:"mo", output:newstr, tex:null, ttype:DEFINITION});
|
||||||
tex:null, ttype:DEFINITION}]);
|
refreshSymbols();
|
||||||
// #### Added from Version 2.0.1 #### //
|
}
|
||||||
AMsymbols.sort(compareNames);
|
|
||||||
for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
|
function newsymbol(symbolobj) {
|
||||||
// #### End of Addition #### //
|
AMsymbols.push(symbolobj);
|
||||||
|
refreshSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
// character lists for Mozilla/Netscape fonts
|
// character lists for Mozilla/Netscape fonts
|
||||||
|
@ -666,14 +667,15 @@ function compareNames(s1,s2) {
|
||||||
var AMnames = []; //list of input symbols
|
var AMnames = []; //list of input symbols
|
||||||
|
|
||||||
function initSymbols() {
|
function initSymbols() {
|
||||||
var texsymbols = [], i;
|
var i;
|
||||||
for (i=0; i<AMsymbols.length; i++)
|
var symlen = AMsymbols.length;
|
||||||
|
for (i=0; i<symlen; i++) {
|
||||||
if (AMsymbols[i].tex) {
|
if (AMsymbols[i].tex) {
|
||||||
texsymbols[texsymbols.length] = {input:AMsymbols[i].tex,
|
AMsymbols.push({input:AMsymbols[i].tex,
|
||||||
tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype,
|
tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype,
|
||||||
acc:(AMsymbols[i].acc||false)};
|
acc:(AMsymbols[i].acc||false)});
|
||||||
}
|
}
|
||||||
AMsymbols = AMsymbols.concat(texsymbols);
|
}
|
||||||
refreshSymbols();
|
refreshSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,8 +686,7 @@ function refreshSymbols(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function define(oldstr,newstr) {
|
function define(oldstr,newstr) {
|
||||||
AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
|
AMsymbols.push({input:oldstr, tag:"mo", output:newstr, tex:null, ttype:DEFINITION});
|
||||||
tex:null, ttype:DEFINITION}]);
|
|
||||||
refreshSymbols(); // this may be a problem if many symbols are defined!
|
refreshSymbols(); // this may be a problem if many symbols are defined!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,6 +1317,7 @@ else if(typeof window.attachEvent != 'undefined'){
|
||||||
|
|
||||||
//expose some functions to outside
|
//expose some functions to outside
|
||||||
asciimath.newcommand = newcommand;
|
asciimath.newcommand = newcommand;
|
||||||
|
asciimath.newsymbol = newsymbol;
|
||||||
asciimath.AMprocesssNode = AMprocessNode;
|
asciimath.AMprocesssNode = AMprocessNode;
|
||||||
asciimath.parseMath = parseMath;
|
asciimath.parseMath = parseMath;
|
||||||
asciimath.translate = translate;
|
asciimath.translate = translate;
|
||||||
|
@ -1409,6 +1411,7 @@ ASCIIMATH.Augment({
|
||||||
|
|
||||||
define: define,
|
define: define,
|
||||||
newcommand: newcommand,
|
newcommand: newcommand,
|
||||||
|
newsymbol: newsymbol,
|
||||||
symbols: AMsymbols,
|
symbols: AMsymbols,
|
||||||
names: AMnames,
|
names: AMnames,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user