MCPcopy Create free account
hub / github.com/TruthHun/BookStack / htmlBuilder$8

Function htmlBuilder$8

static/katex/katex.mjs:11061–11290  ·  view source on GitHub ↗
(grp, options)

Source from the content-addressed store, hash-verified

11059// Limits, symbols
11060// NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
11061const htmlBuilder$8 = (grp, options) => {
11062 // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
11063 let supGroup;
11064 let subGroup;
11065 let hasLimits = false;
11066 let group;
11067 const supSub = checkNodeType(grp, "supsub");
11068
11069 if (supSub) {
11070 // If we have limits, supsub will pass us its group to handle. Pull
11071 // out the superscript and subscript and set the group to the op in
11072 // its base.
11073 supGroup = supSub.sup;
11074 subGroup = supSub.sub;
11075 group = assertNodeType(supSub.base, "op");
11076 hasLimits = true;
11077 } else {
11078 group = assertNodeType(grp, "op");
11079 }
11080
11081 const style = options.style; // Most operators have a large successor symbol, but these don't.
11082
11083 const noSuccessor = ["\\smallint"];
11084 let large = false;
11085
11086 if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
11087 // Most symbol operators get larger in displaystyle (rule 13)
11088 large = true;
11089 }
11090
11091 let base;
11092
11093 if (group.symbol) {
11094 // If this is a symbol, create the symbol.
11095 const fontName = large ? "Size2-Regular" : "Size1-Regular";
11096 let stash = "";
11097
11098 if (group.name === "\\oiint" || group.name === "\\oiiint") {
11099 // No font glyphs yet, so use a glyph w/o the oval.
11100 // TODO: When font glyphs are available, delete this code.
11101 stash = group.name.substr(1); // $FlowFixMe
11102
11103 group.name = stash === "oiint" ? "\\iint" : "\\iiint";
11104 }
11105
11106 base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
11107
11108 if (stash.length > 0) {
11109 // We're in \oiint or \oiiint. Overlay the oval.
11110 // TODO: When font glyphs are available, delete this code.
11111 const italic = base.italic;
11112 const oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options);
11113 base = buildCommon.makeVList({
11114 positionType: "individualShift",
11115 children: [{
11116 type: "elem",
11117 elem: base,
11118 shift: 0

Callers

nothing calls this directly

Calls 8

buildExpressionFunction · 0.85
buildGroupFunction · 0.85
fontMetricsMethod · 0.80
havingStyleMethod · 0.80
supMethod · 0.80
subMethod · 0.80
checkNodeTypeFunction · 0.70
assertNodeTypeFunction · 0.70

Tested by

no test coverage detected