From 07fb4c9ed3225df34e3872dbebcb44bb6f6e7671 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Sun, 17 Nov 2019 20:03:25 -0500 Subject: [PATCH 1/2] Remove the mi2mo() action for munderover constructs (since a postfilter now handles non-mo elements with movable limits) --- ts/core/MmlTree/MmlNodes/mo.ts | 3 ++- ts/input/tex/ParseUtil.ts | 29 +++++++---------------------- ts/input/tex/base/BaseMethods.ts | 8 -------- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/ts/core/MmlTree/MmlNodes/mo.ts b/ts/core/MmlTree/MmlNodes/mo.ts index 112d0729e..b8c910b52 100644 --- a/ts/core/MmlTree/MmlNodes/mo.ts +++ b/ts/core/MmlTree/MmlNodes/mo.ts @@ -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; } diff --git a/ts/input/tex/ParseUtil.ts b/ts/input/tex/ParseUtil.ts index 2bc44bdf0..8ee4f96f5 100644 --- a/ts/input/tex/ParseUtil.ts +++ b/ts/input/tex/ParseUtil.ts @@ -192,10 +192,12 @@ namespace ParseUtil { /** - * If the initial child, skipping any initial space or - * empty braces (TeXAtom with child being an empty inferred row), - * is an , preceed it by an empty to force the to - * be infix. + * If the initial child, skipping any initial space or + * empty braces (TeXAtom with child being an empty inferred row), + * is an , precede it by an empty to force the to + * be infix. + * @param {ParseOptions} configuration The current parse otpions. + * @param {MmlNodep[]} nodes The row of nodes to scan for an initial */ export function fixInitialMO(configuration: ParseOptions, nodes: MmlNode[]) { for (let i = 0, m = nodes.length; i < m; i++) { @@ -215,24 +217,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. diff --git a/ts/input/tex/base/BaseMethods.ts b/ts/input/tex/base/BaseMethods.ts index 4c8b7e977..221ac1f23 100644 --- a/ts/input/tex/base/BaseMethods.ts +++ b/ts/input/tex/base/BaseMethods.ts @@ -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}); } @@ -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}); } From 9055788ecebabd63a9b885c6a0a70c0d421f6596 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Mon, 16 Dec 2019 14:28:12 -0500 Subject: [PATCH 2/2] Fix typo (as per Volker's comments) --- ts/input/tex/ParseUtil.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/input/tex/ParseUtil.ts b/ts/input/tex/ParseUtil.ts index 8ee4f96f5..2553717e1 100644 --- a/ts/input/tex/ParseUtil.ts +++ b/ts/input/tex/ParseUtil.ts @@ -196,7 +196,7 @@ namespace ParseUtil { * empty braces (TeXAtom with child being an empty inferred row), * is an , precede it by an empty to force the to * be infix. - * @param {ParseOptions} configuration The current parse otpions. + * @param {ParseOptions} configuration The current parse options. * @param {MmlNodep[]} nodes The row of nodes to scan for an initial */ export function fixInitialMO(configuration: ParseOptions, nodes: MmlNode[]) {