UNPKG

882 BJavaScriptView Raw
1// @flow
2import defineFunction, {ordargument} from "../defineFunction";
3import buildCommon from "../buildCommon";
4
5import * as html from "../buildHTML";
6import * as mml from "../buildMathML";
7
8defineFunction({
9 type: "htmlmathml",
10 names: ["\\html@mathml"],
11 props: {
12 numArgs: 2,
13 allowedInText: true,
14 },
15 handler: ({parser}, args) => {
16 return {
17 type: "htmlmathml",
18 mode: parser.mode,
19 html: ordargument(args[0]),
20 mathml: ordargument(args[1]),
21 };
22 },
23 htmlBuilder: (group, options) => {
24 const elements = html.buildExpression(
25 group.html,
26 options,
27 false
28 );
29 return buildCommon.makeFragment(elements);
30 },
31 mathmlBuilder: (group, options) => {
32 return mml.buildExpressionRow(group.mathml, options);
33 },
34});