Skip to content

Commit

Permalink
Merge pull request #392 from mathjax/no-mi2mo
Browse files Browse the repository at this point in the history
Remove mi2mo action
  • Loading branch information
dpvc authored Dec 16, 2019
2 parents 9faddcf + 9055788 commit f945b0d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
3 changes: 2 additions & 1 deletion ts/core/MmlTree/MmlNodes/mo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ export class MmlMo extends AbstractMmlTokenNode {
*/
public setTeXclass(prev: MmlNode): MmlNode {
let {form, fence} = this.attributes.getList('form', 'fence') as {form: string, fence: string};
if (this.attributes.isSet('lspace') || this.attributes.isSet('rspace')) {
if (this.getProperty('texClass') === undefined &&
(this.attributes.isSet('lspace') || this.attributes.isSet('rspace'))) {
this.texClass = TEXCLASS.NONE;
return null;
}
Expand Down
29 changes: 7 additions & 22 deletions ts/input/tex/ParseUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ namespace ParseUtil {


/**
* If the initial child, skipping any initial space or
* empty braces (TeXAtom with child being an empty inferred row),
* is an <mo>, preceed it by an empty <mi> to force the <mo> to
* be infix.
* If the initial child, skipping any initial space or
* empty braces (TeXAtom with child being an empty inferred row),
* is an <mo>, precede it by an empty <mi> to force the <mo> to
* be infix.
* @param {ParseOptions} configuration The current parse options.
* @param {MmlNodep[]} nodes The row of nodes to scan for an initial <mo>
*/
export function fixInitialMO(configuration: ParseOptions, nodes: MmlNode[]) {
for (let i = 0, m = nodes.length; i < m; i++) {
Expand All @@ -230,24 +232,7 @@ namespace ParseUtil {


/**
* Rewrites an mi node into an mo node.
* @param {TexParser} parser The current TexParser.
* @param {MmlNode} mi The mi node.
* @return {MmlNode} The corresponding mo node.
*/
export function mi2mo(parser: TexParser, mi: MmlNode): MmlNode {
// @test Mathop Sub, Mathop Super
const mo = parser.create('node', 'mo');
NodeUtil.copyChildren(mi, mo);
NodeUtil.copyAttributes(mi, mo);
NodeUtil.setProperties(mo, {lspace: '0', rspace: '0'});
NodeUtil.removeProperties(mo, 'movesupsub');
return mo;
}


/**
* Break up a string into text and math blocks.
* Break up a string into text and math blocks.
* @param {TexParser} parser The calling parser.
* @param {string} text The text in the math expression to parse.
* @param {number|string=} level The scriptlevel.
Expand Down
8 changes: 0 additions & 8 deletions ts/input/tex/base/BaseMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ BaseMethods.Superscript = function(parser: TexParser, c: string) {
// @test Move Superscript, Large Operator
if (!NodeUtil.isType(base, 'munderover') || NodeUtil.isType(base, 'mover') ||
NodeUtil.getChildAt(base, (base as MmlMunderover).over)) {
if (NodeUtil.getProperty(base, 'movablelimits') && NodeUtil.isType(base, 'mi')) {
// @test Mathop Super
base = ParseUtil.mi2mo(parser, base);
}
// @test Large Operator
base = parser.create('node', 'munderover', [base], {movesupsub: true});
}
Expand Down Expand Up @@ -200,10 +196,6 @@ BaseMethods.Subscript = function(parser: TexParser, c: string) {
// @test Large Operator, Move Superscript
if (!NodeUtil.isType(base, 'munderover') || NodeUtil.isType(base, 'mover') ||
NodeUtil.getChildAt(base, (base as MmlMunderover).under)) {
if (NodeUtil.getProperty(base, 'movablelimits') && NodeUtil.isType(base, 'mi')) {
// @test Mathop Sub
base = ParseUtil.mi2mo(parser, base);
}
// @test Move Superscript
base = parser.create('node', 'munderover', [base], {movesupsub: true});
}
Expand Down

0 comments on commit f945b0d

Please sign in to comment.