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,27 +308,29 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} correc
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<msub>
<mo>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mo>
<mrow>
<mi>
x
</mi>
<mo>
</mo>
<mi mathvariant="normal">
</mi>
</mrow>
</msub>
<mo>
<msub>
<mrow>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mrow>
<mrow>
<mi>
x
</mi>
<mo>
</mo>
<mi mathvariant="normal">
</mi>
</mrow>
</msub>
</mo>
</mrow>
<annotation encoding="application/x-tex">
\\limsup_{x \\rightarrow \\infty}
@@ -343,27 +345,29 @@ exports[`A MathML builder should output \\limsup_{x \\rightarrow \\infty} in dis
>
<semantics>
<mrow>
<munder>
<mo>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mo>
<mrow>
<mi>
x
</mi>
<mo>
</mo>
<mi mathvariant="normal">
</mi>
</mrow>
</munder>
<mo>
<munder>
<mrow>
<mi mathvariant="normal">
limsup
</mi>
<mo>
</mo>
</mrow>
<mrow>
<mi>
x
</mi>
<mo>
</mo>
<mi mathvariant="normal">
</mi>
</mrow>
</munder>
</mo>
</mrow>
<annotation encoding="application/x-tex">
\\limsup_{x \\rightarrow \\infty}
@@ -420,25 +424,27 @@ exports[`A MathML builder should render mathchoice as if there was nothing 1`] =
displaystyle="true"
>
<mrow>
<munderover>
<mo>
</mo>
<mrow>
<mi>
k
</mi>
<mo>
<munderover>
<mo>
=
</mo>
<mn>
0
</mn>
</mrow>
<mi mathvariant="normal">
</mi>
</munderover>
<mrow>
<mi>
k
</mi>
<mo>
=
</mo>
<mn>
0
</mn>
</mrow>
<mi mathvariant="normal">
</mi>
</munderover>
</mo>
<msup>
<mi>
x
@@ -461,25 +467,27 @@ exports[`A MathML builder should render mathchoice as if there was nothing 2`] =
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<msubsup>
<mo>
</mo>
<mrow>
<mi>
k
</mi>
<mo>
<msubsup>
<mo>
=
</mo>
<mn>
0
</mn>
</mrow>
<mi mathvariant="normal">
</mi>
</msubsup>
<mrow>
<mi>
k
</mi>
<mo>
=
</mo>
<mn>
0
</mn>
</mrow>
<mi mathvariant="normal">
</mi>
</msubsup>
</mo>
<msup>
<mi>
x
@@ -695,45 +703,51 @@ exports[`A MathML builder should use <msupsub> for integrals 1`] = `
<mstyle scriptlevel="0"
displaystyle="true"
>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
<mo>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
</mo>
<mo>
+
</mo>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
<mo>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
</mo>
<mo>
+
</mo>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
<mo>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">
@@ -750,17 +764,19 @@ exports[`A MathML builder should use <msupsub> for regular operators 1`] = `
<mstyle scriptlevel="0"
displaystyle="false"
>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
<mo>
<msubsup>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</msubsup>
</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">
@@ -777,17 +793,19 @@ exports[`A MathML builder should use <munderover> for large operators 1`] = `
<mstyle scriptlevel="0"
displaystyle="true"
>
<munderover>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</munderover>
<mo>
<munderover>
<mo>
</mo>
<mi>
a
</mi>
<mi>
b
</mi>
</munderover>
</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">