Move code that prevents numbers from being treated as a unit for super- and subscripts to the super- and subscript routines (instead of prefiltering for it). Resolves issue #192.
This commit is contained in:
parent
388595f4fe
commit
b5ab1e96c0
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
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
File diff suppressed because one or more lines are too long
|
@ -1137,6 +1137,8 @@
|
|||
* Handle ^, _, and '
|
||||
*/
|
||||
Superscript: function (c) {
|
||||
if (this.GetNext().match(/\d/)) // don't treat numbers as a unit
|
||||
{this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)}
|
||||
var position, base = this.stack.Prev(); if (!base) {base = MML.mi("")}
|
||||
if (base.isEmbellishedWrapper) {base = base.data[0].data[0]}
|
||||
if (base.type === "msubsup") {
|
||||
|
@ -1158,6 +1160,8 @@
|
|||
this.Push(STACKITEM.subsup(base).With({position: position}));
|
||||
},
|
||||
Subscript: function (c) {
|
||||
if (this.GetNext().match(/\d/)) // don't treat numbers as a unit
|
||||
{this.string = this.string.substr(0,this.i+1)+" "+this.string.substr(this.i+1)}
|
||||
var position, base = this.stack.Prev(); if (!base) {base = MML.mi("")}
|
||||
if (base.isEmbellishedWrapper) {base = base.data[0].data[0]}
|
||||
if (base.type === "msubsup") {
|
||||
|
@ -1998,8 +2002,7 @@
|
|||
// Konqueror incorrectly quotes these characters in script.innerHTML
|
||||
if (HUB.Browser.isKonqueror)
|
||||
{math = math.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}
|
||||
// avoid parsing super- and subscript numbers as a unit
|
||||
return math.replace(/([_^]\s*\d)([0-9.,])/g,"$1 $2");
|
||||
return math;
|
||||
},
|
||||
postfilterMath: function (math,displaystyle,script) {
|
||||
this.combineRelations(math.root);
|
||||
|
|
Loading…
Reference in New Issue
Block a user