1 |
|
2 | import {defineFunctionBuilders} from "../defineFunction";
|
3 | import buildCommon from "../buildCommon";
|
4 | import mathMLTree from "../mathMLTree";
|
5 |
|
6 | import * as mml from "../buildMathML";
|
7 |
|
8 |
|
9 |
|
10 | defineFunctionBuilders({
|
11 | type: "atom",
|
12 | htmlBuilder(group, options) {
|
13 | return buildCommon.mathsym(
|
14 | group.text, group.mode, options, ["m" + group.family]);
|
15 | },
|
16 | mathmlBuilder(group, options) {
|
17 | const node = new mathMLTree.MathNode(
|
18 | "mo", [mml.makeText(group.text, group.mode)]);
|
19 | if (group.family === "bin") {
|
20 | const variant = mml.getVariant(group, options);
|
21 | if (variant === "bold-italic") {
|
22 | node.setAttribute("mathvariant", variant);
|
23 | }
|
24 | } else if (group.family === "punct") {
|
25 | node.setAttribute("separator", "true");
|
26 | } else if (group.family === "open" || group.family === "close") {
|
27 |
|
28 |
|
29 | node.setAttribute("stretchy", "false");
|
30 | }
|
31 | return node;
|
32 | },
|
33 | });
|
34 |
|