1 |
|
2 | import defineFunction from "../defineFunction";
|
3 | import buildCommon from "../buildCommon";
|
4 | import mathMLTree from "../mathMLTree";
|
5 |
|
6 | import * as html from "../buildHTML";
|
7 | import * as mml from "../buildMathML";
|
8 |
|
9 | defineFunction({
|
10 | type: "overline",
|
11 | names: ["\\overline"],
|
12 | props: {
|
13 | numArgs: 1,
|
14 | },
|
15 | handler({parser}, args) {
|
16 | const body = args[0];
|
17 | return {
|
18 | type: "overline",
|
19 | mode: parser.mode,
|
20 | body,
|
21 | };
|
22 | },
|
23 | htmlBuilder(group, options) {
|
24 |
|
25 |
|
26 |
|
27 | const innerGroup = html.buildGroup(group.body,
|
28 | options.havingCrampedStyle());
|
29 |
|
30 |
|
31 | const line = buildCommon.makeLineSpan("overline-line", options);
|
32 |
|
33 |
|
34 | const vlist = buildCommon.makeVList({
|
35 | positionType: "firstBaseline",
|
36 | children: [
|
37 | {type: "elem", elem: innerGroup},
|
38 | {type: "kern", size: 3 * line.height},
|
39 | {type: "elem", elem: line},
|
40 | {type: "kern", size: line.height},
|
41 | ],
|
42 | }, options);
|
43 |
|
44 | return buildCommon.makeSpan(["mord", "overline"], [vlist], options);
|
45 | },
|
46 | mathmlBuilder(group, options) {
|
47 | const operator = new mathMLTree.MathNode(
|
48 | "mo", [new mathMLTree.TextNode("\u203e")]);
|
49 | operator.setAttribute("stretchy", "true");
|
50 |
|
51 | const node = new mathMLTree.MathNode(
|
52 | "mover",
|
53 | [mml.buildGroup(group.body, options), operator]);
|
54 | node.setAttribute("accent", "true");
|
55 |
|
56 | return node;
|
57 | },
|
58 | });
|