fix: MathML \lim\limits in Safari (#2556)

Co-authored-by: ylemkimon <y@ylem.kim>
This commit is contained in:
Ron Kok
2020-10-03 05:11:24 -07:00
committed by GitHub
parent 6360401236
commit c8042ccb55
4 changed files with 157 additions and 134 deletions

View File

@@ -164,7 +164,7 @@ const mathmlBuilder: MathMLBuilder<"op"> = (group, options) => {
const operator = new mathMLTree.MathNode("mo",
[mml.makeText("\u2061", "text")]);
if (group.parentIsSupSub) {
node = new mathMLTree.MathNode("mo", [node, operator]);
node = new mathMLTree.MathNode("mrow", [node, operator]);
} else {
node = mathMLTree.newDocumentFragment([node, operator]);
}

View File

@@ -130,7 +130,7 @@ const mathmlBuilder: MathMLBuilder<"operatorname"> = (group, options) => {
[mml.makeText("\u2061", "text")]);
if (group.parentIsSupSub) {
return new mathMLTree.MathNode("mo", [identifier, operator]);
return new mathMLTree.MathNode("mrow", [identifier, operator]);
} else {
return mathMLTree.newDocumentFragment([identifier, operator]);
}

View File

@@ -260,7 +260,12 @@ defineFunctionBuilders({
}
}
const node = new mathMLTree.MathNode(nodeType, children);
let node = new mathMLTree.MathNode(nodeType, children);
if (group.base && (group.base.type === "op" ||
group.base.type === "operatorname")) {
node = new mathMLTree.MathNode("mo", [node]);
}
return node;
},

View File

@@ -308,15 +308,16 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correc
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<msub>
<mo>
<msub>
<mrow>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mo>
</mrow>
<mrow>
<mi>
x
@@ -329,6 +330,7 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correc
</mi>
</mrow>
</msub>
</mo>
</mrow>
<annotation encoding="application/x-tex">
\\limsup_{x \\rightarrow \\infty}
@@ -343,15 +345,16 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in dis
>
<semantics>
<mrow>
<munder>
<mo>
<munder>
<mrow>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mo>
</mrow>
<mrow>
<mi>
x
@@ -364,6 +367,7 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in dis
</mi>
</mrow>
</munder>
</mo>
</mrow>
<annotation encoding="application/x-tex">
\\limsup_{x \\rightarrow \\infty}
@@ -420,6 +424,7 @@ exports[`A MathML builder should render mathchoice as if there was nothing 1`] =
displaystyle="true"
>
<mrow>
<mo>
<munderover>
<mo>
@@ -439,6 +444,7 @@ exports[`A MathML builder should render mathchoice as if there was nothing 1`] =
</mi>
</munderover>
</mo>
<msup>
<mi>
x
@@ -461,6 +467,7 @@ exports[`A MathML builder should render mathchoice as if there was nothing 2`] =
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<mo>
<msubsup>
<mo>
@@ -480,6 +487,7 @@ exports[`A MathML builder should render mathchoice as if there was nothing 2`] =
</mi>
</msubsup>
</mo>
<msup>
<mi>
x
@@ -695,6 +703,7 @@ exports[`A MathML builder should use <msupsub> for integrals 1`] = `
<mstyle scriptlevel="0"
displaystyle="true"
>
<mo>
<msubsup>
<mo>
@@ -706,9 +715,11 @@ exports[`A MathML builder should use <msupsub> for integrals 1`] = `
b
</mi>
</msubsup>
</mo>
<mo>
+
</mo>
<mo>
<msubsup>
<mo>
@@ -720,9 +731,11 @@ exports[`A MathML builder should use <msupsub> for integrals 1`] = `
b
</mi>
</msubsup>
</mo>
<mo>
+
</mo>
<mo>
<msubsup>
<mo>
@@ -734,6 +747,7 @@ exports[`A MathML builder should use <msupsub> for integrals 1`] = `
b
</mi>
</msubsup>
</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">
@@ -750,6 +764,7 @@ exports[`A MathML builder should use <msupsub> for regular operators 1`] = `
<mstyle scriptlevel="0"
displaystyle="false"
>
<mo>
<msubsup>
<mo>
@@ -761,6 +776,7 @@ exports[`A MathML builder should use <msupsub> for regular operators 1`] = `
b
</mi>
</msubsup>
</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">
@@ -777,6 +793,7 @@ exports[`A MathML builder should use <munderover> for large operators 1`] = `
<mstyle scriptlevel="0"
displaystyle="true"
>
<mo>
<munderover>
<mo>
@@ -788,6 +805,7 @@ exports[`A MathML builder should use <munderover> for large operators 1`] = `
b
</mi>
</munderover>
</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">