Append ApplyFunction to math functions (#960)

* Append ApplyFunction to math functions

As described at: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4

Character U+2061 is the same as ⁡. Ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp

* Add comment for \u2061
This commit is contained in:
Ron Kok
2017-11-22 05:21:56 -08:00
committed by Erik Demaine
parent 6f1661f7da
commit 22dd4f3a28
3 changed files with 12 additions and 3 deletions

View File

@@ -209,8 +209,12 @@ const mathmlBuilder = (group, options) => {
node = new mathMLTree.MathNode(
"mi", [new mathMLTree.TextNode(group.value.body.slice(1))]);
// TODO(ron): Append an <mo>&ApplyFunction;</mo> as in \operatorname
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.2
// Append an <mo>&ApplyFunction;</mo>.
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
const operator = new mathMLTree.MathNode("mo",
[mml.makeText("\u2061", "text")]);
return new domTree.documentFragment([node, operator]);
}
return node;

View File

@@ -68,8 +68,10 @@ defineFunction({
const identifier = new mathMLTree.MathNode("mi", output);
identifier.setAttribute("mathvariant", "normal");
// \u2061 is the same as &ApplyFunction;
// ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
const operator = new mathMLTree.MathNode("mo",
[mml.makeText("&ApplyFunction;", "text")]);
[mml.makeText("\u2061", "text")]);
return new domTree.documentFragment([identifier, operator]);
},

View File

@@ -27,6 +27,9 @@ exports[`A MathML builder should generate the right types of nodes 1`] = `
<mi>
sin
</mi>
<mo>
</mo>
<mrow>
<mi>
x