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

Function htmlBuilder$3

static/katex/katex.mjs:9308–9541  ·  view source on GitHub ↗
(group, options)

Source from the content-addressed store, hash-verified

9306}
9307
9308const htmlBuilder$3 = function htmlBuilder(group, options) {
9309 let r;
9310 let c;
9311 const nr = group.body.length;
9312 const hLinesBeforeRow = group.hLinesBeforeRow;
9313 let nc = 0;
9314 let body = new Array(nr);
9315 const hlines = []; // Horizontal spacing
9316
9317 const pt = 1 / options.fontMetrics().ptPerEm;
9318 const arraycolsep = 5 * pt; // \arraycolsep in article.cls
9319 // Vertical spacing
9320
9321 const baselineskip = 12 * pt; // see size10.clo
9322 // Default \jot from ltmath.dtx
9323 // TODO(edemaine): allow overriding \jot via \setlength (#687)
9324
9325 const jot = 3 * pt;
9326 const arrayskip = group.arraystretch * baselineskip;
9327 const arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and
9328
9329 const arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx
9330
9331 let totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any.
9332
9333 function setHLinePos(hlinesInGap) {
9334 for (let i = 0; i < hlinesInGap.length; ++i) {
9335 if (i > 0) {
9336 totalHeight += 0.25;
9337 }
9338
9339 hlines.push({
9340 pos: totalHeight,
9341 isDashed: hlinesInGap[i]
9342 });
9343 }
9344 }
9345
9346 setHLinePos(hLinesBeforeRow[0]);
9347
9348 for (r = 0; r < group.body.length; ++r) {
9349 const inrow = group.body[r];
9350 let height = arstrutHeight; // \@array adds an \@arstrut
9351
9352 let depth = arstrutDepth; // to each tow (via the template)
9353
9354 if (nc < inrow.length) {
9355 nc = inrow.length;
9356 }
9357
9358 const outrow = new Array(inrow.length);
9359
9360 for (c = 0; c < inrow.length; ++c) {
9361 const elt = buildGroup(inrow[c], options);
9362
9363 if (depth < elt.depth) {
9364 depth = elt.depth;
9365 }

Callers

nothing calls this directly

Calls 4

buildGroupFunction · 0.85
calculateSizeFunction · 0.85
fontMetricsMethod · 0.80
setHLinePosFunction · 0.70

Tested by

no test coverage detected