forked from KaTeX/KaTeX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymbolsOp.js
34 lines (30 loc) · 1.18 KB
/
symbolsOp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// @flow
import {defineFunctionBuilders} from "../defineFunction";
import buildCommon from "../buildCommon";
import mathMLTree from "../mathMLTree";
import * as mml from "../buildMathML";
// Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js.
defineFunctionBuilders({
type: "atom",
htmlBuilder(group, options) {
return buildCommon.mathsym(
group.text, group.mode, options, ["m" + group.family]);
},
mathmlBuilder(group, options) {
const node = new mathMLTree.MathNode(
"mo", [mml.makeText(group.text, group.mode)]);
if (group.family === "bin") {
const variant = mml.getVariant(group, options);
if (variant === "bold-italic") {
node.setAttribute("mathvariant", variant);
}
} else if (group.family === "punct") {
node.setAttribute("separator", "true");
} else if (group.family === "open" || group.family === "close") {
// Delims built here should not stretch vertically.
// See delimsizing.js for stretchy delims.
node.setAttribute("stretchy", "false");
}
return node;
},
});