MCPcopy Index your code
hub / github.com/TruthHun/BookStack / array_htmlBuilder

Function array_htmlBuilder

static/katex/katex.js:9457–9691  ·  view source on GitHub ↗
(group, options)

Source from the content-addressed store, hash-verified

9455}
9456
9457var array_htmlBuilder = function htmlBuilder(group, options) {
9458 var r;
9459 var c;
9460 var nr = group.body.length;
9461 var hLinesBeforeRow = group.hLinesBeforeRow;
9462 var nc = 0;
9463 var body = new Array(nr);
9464 var hlines = []; // Horizontal spacing
9465
9466 var pt = 1 / options.fontMetrics().ptPerEm;
9467 var arraycolsep = 5 * pt; // \arraycolsep in article.cls
9468 // Vertical spacing
9469
9470 var baselineskip = 12 * pt; // see size10.clo
9471 // Default \jot from ltmath.dtx
9472 // TODO(edemaine): allow overriding \jot via \setlength (#687)
9473
9474 var jot = 3 * pt;
9475 var arrayskip = group.arraystretch * baselineskip;
9476 var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and
9477
9478 var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx
9479
9480 var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any.
9481
9482 function setHLinePos(hlinesInGap) {
9483 for (var i = 0; i < hlinesInGap.length; ++i) {
9484 if (i > 0) {
9485 totalHeight += 0.25;
9486 }
9487
9488 hlines.push({
9489 pos: totalHeight,
9490 isDashed: hlinesInGap[i]
9491 });
9492 }
9493 }
9494
9495 setHLinePos(hLinesBeforeRow[0]);
9496
9497 for (r = 0; r < group.body.length; ++r) {
9498 var inrow = group.body[r];
9499 var height = arstrutHeight; // \@array adds an \@arstrut
9500
9501 var depth = arstrutDepth; // to each tow (via the template)
9502
9503 if (nc < inrow.length) {
9504 nc = inrow.length;
9505 }
9506
9507 var outrow = new Array(inrow.length);
9508
9509 for (c = 0; c < inrow.length; ++c) {
9510 var elt = buildHTML_buildGroup(inrow[c], options);
9511
9512 if (depth < elt.depth) {
9513 depth = elt.depth;
9514 }

Callers

nothing calls this directly

Calls 4

buildHTML_buildGroupFunction · 0.85
units_calculateSizeFunction · 0.85
fontMetricsMethod · 0.80
setHLinePosFunction · 0.70

Tested by

no test coverage detected