Skip to content

Commit

Permalink
Append ApplyFunction to math functions (#960)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ronkok authored and edemaine committed Nov 22, 2017
1 parent 6f1661f commit 22dd4f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/functions/op.js
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/functions/operatorname.js
Expand Up @@ -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]);
},
Expand Down
3 changes: 3 additions & 0 deletions test/__snapshots__/mathml-spec.js.snap
Expand Up @@ -27,6 +27,9 @@ exports[`A MathML builder should generate the right types of nodes 1`] = `
<mi>
sin
</mi>
<mo>
</mo>
<mrow>
<mi>
x
Expand Down

0 comments on commit 22dd4f3

Please sign in to comment.