MCPcopy
hub / github.com/KaTeX/KaTeX / handler

Function handler

src/environments/array.ts:798–833  ·  view source on GitHub ↗
(context, args)

Source from the content-addressed store, hash-verified

796 numArgs: 1,
797 },
798 handler(context, args) {
799 // Since no types are specified above, the two possibilities are
800 // - The argument is wrapped in {} or [], in which case Parser's
801 // parseGroup() returns an "ordgroup" wrapping some symbol node.
802 // - The argument is a bare symbol node.
803 const symNode = checkSymbolNodeType(args[0]);
804 const colalign: AnyParseNode[] =
805 symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
806 const cols: AlignSpec[] = colalign.map(function(nde) {
807 const node = assertSymbolNodeType(nde);
808 const ca = node.text;
809 if ("lcr".includes(ca)) {
810 return {
811 type: "align",
812 align: ca,
813 };
814 } else if (ca === "|") {
815 return {
816 type: "separator",
817 separator: "|",
818 };
819 } else if (ca === ":") {
820 return {
821 type: "separator",
822 separator: ":",
823 };
824 }
825 throw new ParseError("Unknown column alignment: " + ca, nde);
826 });
827 const res: Parameters<typeof parseArray>[1] = {
828 cols,
829 hskipBeforeAndAfter: true, // \@preamble in lttab.dtx
830 maxNumCols: cols.length,
831 };
832 return parseArray(context.parser, res, dCellStyle(context.envName));
833 },
834 htmlBuilder,
835 mathmlBuilder,
836});

Callers

nothing calls this directly

Calls 13

checkSymbolNodeTypeFunction · 0.90
assertNodeTypeFunction · 0.90
assertSymbolNodeTypeFunction · 0.90
parseCDFunction · 0.90
parseArrayFunction · 0.85
dCellStyleFunction · 0.85
getAutoTagFunction · 0.85
fetchMethod · 0.80
consumeMethod · 0.80
expectMethod · 0.80
hasMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…