@khanacademy/perseus-linter 8.1.0 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +88 -56
- package/dist/index.js.map +1 -1
- package/dist/rules/sorter-widget-warning.d.ts +4 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { parse as o, traverseContent as s } from "@khanacademy/pure-markdown";
|
|
|
4
4
|
import * as c from "@khanacademy/kas";
|
|
5
5
|
import { vector as l } from "@khanacademy/kmath";
|
|
6
6
|
//#region \0rolldown/runtime.js
|
|
7
|
-
var u = "@khanacademy/perseus-linter", d = "8.
|
|
7
|
+
var u = "@khanacademy/perseus-linter", d = "8.2.0";
|
|
8
8
|
e(u, d);
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region packages/perseus-linter/src/proptypes.ts
|
|
@@ -344,7 +344,7 @@ var _ = "Don't use explanation widgets in graded groups. Use the Graded Group Hi
|
|
|
344
344
|
lint: function(e) {
|
|
345
345
|
if (hasExplanation(e.options.widgets)) return linterWarning(`Contains explanation widget. ${_}`);
|
|
346
346
|
}
|
|
347
|
-
}),
|
|
347
|
+
}), ie = h.makeWidgetRule({
|
|
348
348
|
name: "explanation-in-graded-group-set",
|
|
349
349
|
widgetType: "graded-group-set",
|
|
350
350
|
lint: function(e) {
|
|
@@ -357,7 +357,7 @@ var _ = "Don't use explanation widgets in graded groups. Use the Graded Group Hi
|
|
|
357
357
|
function buttonNotInButtonSet(e, t) {
|
|
358
358
|
return `Answer requires a button not found in the button sets: ${e} (in ${t})`;
|
|
359
359
|
}
|
|
360
|
-
var
|
|
360
|
+
var v = {
|
|
361
361
|
"\\sqrt": "prealgebra",
|
|
362
362
|
"^": "prealgebra",
|
|
363
363
|
"\\sin": "trig",
|
|
@@ -365,14 +365,14 @@ var y = {
|
|
|
365
365
|
"\\tan": "trig",
|
|
366
366
|
"\\log": "logarithms",
|
|
367
367
|
"\\ln": "logarithms"
|
|
368
|
-
},
|
|
368
|
+
}, y = h.makeWidgetRule({
|
|
369
369
|
name: "expression-widget-buttons",
|
|
370
370
|
widgetType: "expression",
|
|
371
371
|
lint(e) {
|
|
372
372
|
let t = e.options.answerForms, n = e.options.buttonSets;
|
|
373
|
-
for (let e of t) for (let [t, r] of Object.entries(
|
|
373
|
+
for (let e of t) for (let [t, r] of Object.entries(v)) if (e.value.includes(t) && !n.includes(r)) return linterWarning(buttonNotInButtonSet(t, r));
|
|
374
374
|
}
|
|
375
|
-
}),
|
|
375
|
+
}), b = h.makeWidgetRule({
|
|
376
376
|
name: "expression-widget-correct-answer",
|
|
377
377
|
widgetType: "expression",
|
|
378
378
|
lint(e) {
|
|
@@ -380,7 +380,7 @@ var y = {
|
|
|
380
380
|
if (t.length === 0) return linterError("No answers specified.");
|
|
381
381
|
if (!t.some((e) => e.considered === "correct")) return linterError("No correct answer specified.");
|
|
382
382
|
}
|
|
383
|
-
}),
|
|
383
|
+
}), x = h.makeWidgetRule({
|
|
384
384
|
name: "expression-widget-answer-forms",
|
|
385
385
|
widgetType: "expression",
|
|
386
386
|
lint(e) {
|
|
@@ -394,7 +394,7 @@ var y = {
|
|
|
394
394
|
i.parsed ? e.simplify && !i.expr.isSimplified() && r.push(`${e.value} isn't simplified, but is required to be.`) : r.push(`Couldn't parse ${e.value}.`);
|
|
395
395
|
}), r.map((e) => linterError(e));
|
|
396
396
|
}
|
|
397
|
-
}),
|
|
397
|
+
}), S = h.makeWidgetRule({
|
|
398
398
|
name: "fill-in-the-blank",
|
|
399
399
|
widgetType: "fill-in-the-blank",
|
|
400
400
|
lint(e, t) {
|
|
@@ -404,13 +404,13 @@ var y = {
|
|
|
404
404
|
images: {}
|
|
405
405
|
}, t);
|
|
406
406
|
}
|
|
407
|
-
}),
|
|
407
|
+
}), C = /\[\[\u2603 (([a-z-]+) ([0-9]+))\]\]/, w = h.makeWidgetRule({
|
|
408
408
|
name: "free-response-widget-error",
|
|
409
409
|
widgetType: "free-response",
|
|
410
410
|
lint(e) {
|
|
411
411
|
let t = e.options.question;
|
|
412
412
|
if (!t) return linterError("The question is empty");
|
|
413
|
-
if (t.match(
|
|
413
|
+
if (t.match(C) != null) return linterError("The question contains a widget");
|
|
414
414
|
}
|
|
415
415
|
});
|
|
416
416
|
//#endregion
|
|
@@ -428,11 +428,11 @@ function lintGradedGroup(e, { contentType: t }) {
|
|
|
428
428
|
}
|
|
429
429
|
//#endregion
|
|
430
430
|
//#region packages/perseus-linter/src/rules/graded-group.ts
|
|
431
|
-
var
|
|
431
|
+
var T = h.makeWidgetRule({
|
|
432
432
|
name: "graded-group",
|
|
433
433
|
widgetType: "graded-group",
|
|
434
434
|
lint: (e, t) => lintGradedGroup(e.options, t)
|
|
435
|
-
}),
|
|
435
|
+
}), E = h.makeWidgetRule({
|
|
436
436
|
name: "graded-group-set",
|
|
437
437
|
widgetType: "graded-group-set",
|
|
438
438
|
lint: (e, t) => e.options.gradedGroups.flatMap((e, n) => lintGradedGroup(e, t).map(prefixGroupNumber(n + 1)))
|
|
@@ -445,19 +445,19 @@ function prefixGroupNumber(e) {
|
|
|
445
445
|
}
|
|
446
446
|
//#endregion
|
|
447
447
|
//#region packages/perseus-linter/src/rules/group.ts
|
|
448
|
-
var
|
|
448
|
+
var D = h.makeWidgetRule({
|
|
449
449
|
name: "group",
|
|
450
450
|
widgetType: "group",
|
|
451
451
|
lint(e, t) {
|
|
452
452
|
return lintPerseusRenderer(e.options, t);
|
|
453
453
|
}
|
|
454
|
-
}),
|
|
454
|
+
}), O = h.makeRule({
|
|
455
455
|
name: "heading-level-1",
|
|
456
456
|
selector: "heading",
|
|
457
457
|
lint: function(e, t, n, r) {
|
|
458
458
|
if (n[0].level === 1) return linterWarning("Don't use level-1 headings:\nBegin headings with two or more # characters.");
|
|
459
459
|
}
|
|
460
|
-
}),
|
|
460
|
+
}), k = h.makeRule({
|
|
461
461
|
name: "heading-level-skip",
|
|
462
462
|
selector: "heading ~ heading",
|
|
463
463
|
lint: function(e, t, n, r) {
|
|
@@ -466,7 +466,7 @@ var O = h.makeWidgetRule({
|
|
|
466
466
|
this heading is level ${i.level} but
|
|
467
467
|
the previous heading was level ${a.level}`);
|
|
468
468
|
}
|
|
469
|
-
}),
|
|
469
|
+
}), A = h.makeRule({
|
|
470
470
|
name: "heading-sentence-case",
|
|
471
471
|
selector: "heading",
|
|
472
472
|
pattern: /^\W*[a-z]/,
|
|
@@ -474,7 +474,7 @@ the previous heading was level ${a.level}`);
|
|
|
474
474
|
severity: h.Severity.GUIDELINE,
|
|
475
475
|
message: "First letter is lowercase:\nthe first letter of a heading should be capitalized."
|
|
476
476
|
})
|
|
477
|
-
}),
|
|
477
|
+
}), j = {
|
|
478
478
|
and: !0,
|
|
479
479
|
nor: !0,
|
|
480
480
|
but: !0,
|
|
@@ -485,16 +485,16 @@ function isCapitalized(e) {
|
|
|
485
485
|
let t = e[0];
|
|
486
486
|
return t === t.toUpperCase();
|
|
487
487
|
}
|
|
488
|
-
var
|
|
488
|
+
var M = h.makeRule({
|
|
489
489
|
name: "heading-title-case",
|
|
490
490
|
selector: "heading",
|
|
491
491
|
pattern: /[^\s:]\s+[A-Z]+[a-z]/,
|
|
492
492
|
locale: "en",
|
|
493
493
|
lint: function(e, t, n, r) {
|
|
494
494
|
let i = t.trim().split(/\s+/);
|
|
495
|
-
if (i.shift(), i = i.filter((e) => e.length > 2 && !
|
|
495
|
+
if (i.shift(), i = i.filter((e) => e.length > 2 && !j.hasOwnProperty(e)), i.length >= 3 && i.every((e) => isCapitalized(e))) return linterGuideline("Title-case heading:\nThis heading appears to be in title-case, but should be sentence-case.\nOnly capitalize the first letter and proper nouns.");
|
|
496
496
|
}
|
|
497
|
-
}),
|
|
497
|
+
}), N = h.makeRule({
|
|
498
498
|
name: "image-alt-text",
|
|
499
499
|
selector: "image",
|
|
500
500
|
lint: function(e, t, n, r) {
|
|
@@ -504,7 +504,7 @@ var N = h.makeRule({
|
|
|
504
504
|
for accessibility, all images should have descriptive alt text.
|
|
505
505
|
This image's alt text is only ${i.alt.length} characters long.`);
|
|
506
506
|
}
|
|
507
|
-
}),
|
|
507
|
+
}), P = h.makeRule({
|
|
508
508
|
name: "image-markdown",
|
|
509
509
|
selector: "image",
|
|
510
510
|
lint: function(e, t, n, r, i) {
|
|
@@ -514,7 +514,7 @@ This image's alt text is only ${i.alt.length} characters long.`);
|
|
|
514
514
|
e.type === "image" && (c = !0);
|
|
515
515
|
}), c) return linterWarning("[Inline markdown image]:\nMarkdown images are not recommended - these are images that use the\n format. Please use the Image widget instead.");
|
|
516
516
|
}
|
|
517
|
-
}),
|
|
517
|
+
}), F = h.makeRule({
|
|
518
518
|
name: "image-spaces-around-urls",
|
|
519
519
|
selector: "image",
|
|
520
520
|
lint: function(e, t, n, r, i) {
|
|
@@ -525,14 +525,14 @@ This image's alt text is only ${i.alt.length} characters long.`);
|
|
|
525
525
|
if (i.content[e - 1] !== "(" || i.content[e + a.length] !== ")") return linterError("Whitespace before or after image url:\nFor images, don't include any space or newlines after '(' or before ')'.\nWhitespace in image URLs causes translation difficulties.");
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
}),
|
|
528
|
+
}), I = h.makeRule({
|
|
529
529
|
name: "image-url-empty",
|
|
530
530
|
selector: "image",
|
|
531
531
|
lint: function(e, t, n) {
|
|
532
532
|
let r = n[0].target;
|
|
533
533
|
if (!r || !r.trim()) return linterError("Images should have a URL");
|
|
534
534
|
}
|
|
535
|
-
}),
|
|
535
|
+
}), L = h.makeWidgetRule({
|
|
536
536
|
name: "image-widget-alt-text",
|
|
537
537
|
widgetType: "image",
|
|
538
538
|
lint(e) {
|
|
@@ -548,7 +548,7 @@ This image's alt text is ${t.trim().length} characters long.
|
|
|
548
548
|
Please pair your alt with a long description below if you need significantly
|
|
549
549
|
more text to sufficiently describe the image.`);
|
|
550
550
|
}
|
|
551
|
-
}),
|
|
551
|
+
}), R = h.makeWidgetRule({
|
|
552
552
|
name: "image-widget-empty-size",
|
|
553
553
|
widgetType: "image",
|
|
554
554
|
lint(e) {
|
|
@@ -558,7 +558,7 @@ more text to sufficiently describe the image.`);
|
|
|
558
558
|
This image has a width of ${t} and a height of ${n}.
|
|
559
559
|
Please use the "Reset to original size" button to set the size of the image.`);
|
|
560
560
|
}
|
|
561
|
-
}),
|
|
561
|
+
}), z = h.makeRule({
|
|
562
562
|
name: "inaccessible-widget",
|
|
563
563
|
selector: "widget",
|
|
564
564
|
lint: function(e, n, r, i, a) {
|
|
@@ -576,7 +576,7 @@ Please use the "Reset to original size" button to set the size of the image.`);
|
|
|
576
576
|
}
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
|
-
}),
|
|
579
|
+
}), B = h.makeWidgetRule({
|
|
580
580
|
name: "interactive-graph-locked-figure-oob",
|
|
581
581
|
widgetType: "interactive-graph",
|
|
582
582
|
lint(e) {
|
|
@@ -623,7 +623,7 @@ function definingPoints(e) {
|
|
|
623
623
|
}
|
|
624
624
|
//#endregion
|
|
625
625
|
//#region packages/perseus-linter/src/rules/interactive-graph-widget-error.ts
|
|
626
|
-
var
|
|
626
|
+
var V = h.makeWidgetRule({
|
|
627
627
|
name: "interactive-graph-widget-error",
|
|
628
628
|
widgetType: "interactive-graph",
|
|
629
629
|
lint(e) {
|
|
@@ -667,7 +667,7 @@ function expectedLabelCount(e) {
|
|
|
667
667
|
}
|
|
668
668
|
//#endregion
|
|
669
669
|
//#region packages/perseus-linter/src/rules/label-image-widget-error.ts
|
|
670
|
-
var
|
|
670
|
+
var H = h.makeWidgetRule({
|
|
671
671
|
name: "label-image-widget-error",
|
|
672
672
|
widgetType: "label-image",
|
|
673
673
|
lint(e) {
|
|
@@ -680,18 +680,18 @@ var U = h.makeWidgetRule({
|
|
|
680
680
|
}
|
|
681
681
|
return t.map((e) => linterError(e));
|
|
682
682
|
}
|
|
683
|
-
}),
|
|
683
|
+
}), U = "ka-perseus-images.s3.amazonaws.com", W = h.makeWidgetRule({
|
|
684
684
|
name: "legacy-gif-url",
|
|
685
685
|
widgetType: "image",
|
|
686
686
|
lint(e) {
|
|
687
687
|
let t = e.options?.backgroundImage?.url;
|
|
688
|
-
if (t && getHostname(t) ===
|
|
689
|
-
gifs hosted at ${
|
|
688
|
+
if (t && getHostname(t) === U && t.toLowerCase().endsWith(".gif")) return linterGuideline(`Legacy gif URL:
|
|
689
|
+
gifs hosted at ${U} might not appear in the editor preview,
|
|
690
690
|
but can still be viewed in the published content. Please use a
|
|
691
691
|
cdn.kastatic.org/ka-perseus-images/ URL instead or confirm the
|
|
692
692
|
image displays correctly in the published content.`);
|
|
693
693
|
}
|
|
694
|
-
}),
|
|
694
|
+
}), G = h.makeRule({
|
|
695
695
|
name: "link-click-here",
|
|
696
696
|
selector: "link",
|
|
697
697
|
pattern: /click here/i,
|
|
@@ -850,13 +850,42 @@ var ve = h.makeWidgetRule({
|
|
|
850
850
|
return n.length < X && t.push(`Sorter requires at least ${X} cards.`), n.some((e) => e.trim() === "") && t.push("Sorter cards cannot be blank."), n.some(hasMixedContent) && t.push("Sorter cards cannot mix images with other content."), t.map((e) => linterError(e));
|
|
851
851
|
}
|
|
852
852
|
}), ye = h.makeWidgetRule({
|
|
853
|
+
name: "sorter-legend-missing",
|
|
854
|
+
widgetType: "sorter",
|
|
855
|
+
lint(e) {
|
|
856
|
+
if (e.options.legend == null) return linterWarning("Sorter exercises without a labeled legend are marked inaccessible.");
|
|
857
|
+
}
|
|
858
|
+
}), be = h.makeWidgetRule({
|
|
859
|
+
name: "sorter-legend-description",
|
|
860
|
+
widgetType: "sorter",
|
|
861
|
+
lint(e) {
|
|
862
|
+
let { legend: t } = e.options;
|
|
863
|
+
if (t != null && t.ariaLabel.trim() === "") return linterWarning("Sorter legend description cannot be blank.");
|
|
864
|
+
}
|
|
865
|
+
}), xe = h.makeWidgetRule({
|
|
866
|
+
name: "sorter-legend-labels",
|
|
867
|
+
widgetType: "sorter",
|
|
868
|
+
lint(e) {
|
|
869
|
+
let { legend: t } = e.options;
|
|
870
|
+
if (t == null) return;
|
|
871
|
+
let n = [{
|
|
872
|
+
side: "start",
|
|
873
|
+
text: t.startLabel
|
|
874
|
+
}, {
|
|
875
|
+
side: "end",
|
|
876
|
+
text: t.endLabel
|
|
877
|
+
}], r = [];
|
|
878
|
+
for (let { side: e, text: t } of n) t.trim() === "" ? r.push(`Sorter legend ${e} label cannot be blank.`) : t.length > 30 && r.push(`Sorter legend ${e} label is longer than 30 characters.`);
|
|
879
|
+
return r.map((e) => linterWarning(e));
|
|
880
|
+
}
|
|
881
|
+
}), Se = h.makeWidgetRule({
|
|
853
882
|
name: "sorter-widget-warning",
|
|
854
883
|
widgetType: "sorter",
|
|
855
884
|
lint(e) {
|
|
856
885
|
let t = [], { layout: n, correct: r = [] } = e.options;
|
|
857
886
|
return r.length > i && t.push(`Sorter cannot have more than ${i} cards.`), n === "horizontal" && r.length > 5 && t.push("Sorter cannot have more than 5 cards in horizontal layout."), r.length > 5 && t.push("Having more than 5 cards in Sorter is discouraged."), t.map((e) => linterWarning(e));
|
|
858
887
|
}
|
|
859
|
-
}),
|
|
888
|
+
}), Z = h.makeRule({
|
|
860
889
|
name: "static-widget-in-question-stem",
|
|
861
890
|
selector: "widget",
|
|
862
891
|
lint: (e, t, n, r, i) => {
|
|
@@ -866,7 +895,7 @@ var ve = h.makeWidgetRule({
|
|
|
866
895
|
let o = i?.widgets?.[a];
|
|
867
896
|
if (o && o.static) return linterWarning("Widget in question stem is static (non-interactive).");
|
|
868
897
|
}
|
|
869
|
-
}),
|
|
898
|
+
}), Ce = "Table is missing a caption:\nScreen reader users rely on a caption to understand what a table contains\nbefore navigating its cells. Add one by putting a line of the form:\n|| Your caption here || directly above the table or using our Titled Table\ntemplate below.", we = "Table caption is empty:\nThis table has a caption line, but there is no text between the || markers,\nso screen reader users hear an empty caption. Please add the appropriate\ntitle for your table.";
|
|
870
899
|
function getTextContent(e) {
|
|
871
900
|
return typeof e == "string" ? e : Array.isArray(e) ? e.map(getTextContent).join("") : e && typeof e == "object" ? getTextContent(e.content) : "";
|
|
872
901
|
}
|
|
@@ -876,16 +905,16 @@ function getTitleText(e) {
|
|
|
876
905
|
function hasEmptyHeaders(e) {
|
|
877
906
|
return e.header.every((e) => getTextContent(e).trim() === "");
|
|
878
907
|
}
|
|
879
|
-
var
|
|
908
|
+
var Te = h.makeRule({
|
|
880
909
|
name: "table-missing-caption",
|
|
881
910
|
selector: "table",
|
|
882
911
|
lint: function(e, t, n) {
|
|
883
912
|
if (hasEmptyHeaders(n[0])) return;
|
|
884
913
|
let r = e.parent();
|
|
885
|
-
if (r?.type !== "titledTable") return linterGuideline(
|
|
886
|
-
if (getTitleText(r) === "") return linterGuideline(
|
|
914
|
+
if (r?.type !== "titledTable") return linterGuideline(Ce);
|
|
915
|
+
if (getTitleText(r) === "") return linterGuideline(we);
|
|
887
916
|
}
|
|
888
|
-
}),
|
|
917
|
+
}), Ee = h.makeRule({
|
|
889
918
|
name: "table-missing-cells",
|
|
890
919
|
selector: "table",
|
|
891
920
|
lint: function(e, t, n, r) {
|
|
@@ -894,24 +923,24 @@ var Z = h.makeRule({
|
|
|
894
923
|
The table header has ${a} cells, but
|
|
895
924
|
Row ${e + 1} has ${o[e]} cells.`);
|
|
896
925
|
}
|
|
897
|
-
}),
|
|
926
|
+
}), De = "This table has only one cell:\nScreen readers announce a table's structure (rows, columns and headers)\nbefore its content, which adds noise when a table holds a single value. Please use\na paragraph or bold text instead.";
|
|
898
927
|
function isSingleCellTable(e) {
|
|
899
928
|
return e.header.length === 1 && e.cells.length <= 1;
|
|
900
929
|
}
|
|
901
|
-
var
|
|
930
|
+
var Oe = h.makeRule({
|
|
902
931
|
name: "table-single-cell",
|
|
903
932
|
selector: "table",
|
|
904
933
|
lint: function(e, t, n) {
|
|
905
|
-
if (isSingleCellTable(n[0])) return linterWarning(
|
|
934
|
+
if (isSingleCellTable(n[0])) return linterWarning(De);
|
|
906
935
|
}
|
|
907
|
-
}),
|
|
936
|
+
}), ke = h.makeRule({
|
|
908
937
|
name: "unbalanced-code-delimiters",
|
|
909
938
|
pattern: /[`~]+/,
|
|
910
939
|
lint: h.makeLintFunction({
|
|
911
940
|
severity: h.Severity.ERROR,
|
|
912
941
|
message: "Unbalanced code delimiters:\ncode blocks should begin and end with the same type and number of delimiters"
|
|
913
942
|
})
|
|
914
|
-
}),
|
|
943
|
+
}), Ae = h.makeRule({
|
|
915
944
|
name: "unescaped-dollar",
|
|
916
945
|
selector: "unescapedDollar",
|
|
917
946
|
lint: h.makeLintFunction({
|
|
@@ -925,19 +954,20 @@ function allRules() {
|
|
|
925
954
|
return [
|
|
926
955
|
te,
|
|
927
956
|
re,
|
|
928
|
-
|
|
957
|
+
ie,
|
|
929
958
|
ne,
|
|
930
|
-
S,
|
|
931
|
-
b,
|
|
932
959
|
x,
|
|
933
|
-
|
|
960
|
+
y,
|
|
961
|
+
b,
|
|
962
|
+
S,
|
|
963
|
+
w,
|
|
964
|
+
E,
|
|
934
965
|
T,
|
|
935
966
|
D,
|
|
936
|
-
E,
|
|
937
967
|
O,
|
|
938
968
|
k,
|
|
939
969
|
A,
|
|
940
|
-
|
|
970
|
+
M,
|
|
941
971
|
N,
|
|
942
972
|
P,
|
|
943
973
|
F,
|
|
@@ -948,9 +978,8 @@ function allRules() {
|
|
|
948
978
|
B,
|
|
949
979
|
V,
|
|
950
980
|
H,
|
|
951
|
-
|
|
981
|
+
W,
|
|
952
982
|
G,
|
|
953
|
-
ie,
|
|
954
983
|
K,
|
|
955
984
|
q,
|
|
956
985
|
J,
|
|
@@ -969,13 +998,16 @@ function allRules() {
|
|
|
969
998
|
ge,
|
|
970
999
|
_e,
|
|
971
1000
|
ve,
|
|
1001
|
+
Se,
|
|
972
1002
|
ye,
|
|
973
1003
|
be,
|
|
1004
|
+
xe,
|
|
974
1005
|
Z,
|
|
975
|
-
Ce,
|
|
976
1006
|
Te,
|
|
977
1007
|
Ee,
|
|
978
|
-
|
|
1008
|
+
Oe,
|
|
1009
|
+
ke,
|
|
1010
|
+
Ae
|
|
979
1011
|
];
|
|
980
1012
|
}
|
|
981
1013
|
//#endregion
|
|
@@ -991,7 +1023,7 @@ var Q = class TreeTransformer {
|
|
|
991
1023
|
return TreeTransformer.isNode(e) && e.type === "text" && typeof e.content == "string";
|
|
992
1024
|
}
|
|
993
1025
|
traverse(e) {
|
|
994
|
-
this._traverse(this.root, new
|
|
1026
|
+
this._traverse(this.root, new je(this.root), e);
|
|
995
1027
|
}
|
|
996
1028
|
_traverse(e, t, n) {
|
|
997
1029
|
let r = "";
|
|
@@ -1011,7 +1043,7 @@ var Q = class TreeTransformer {
|
|
|
1011
1043
|
}
|
|
1012
1044
|
return r;
|
|
1013
1045
|
}
|
|
1014
|
-
},
|
|
1046
|
+
}, je = class TraversalState {
|
|
1015
1047
|
constructor(e) {
|
|
1016
1048
|
this.root = e, this._currentNode = null, this._containers = new $(), this._indexes = new $(), this._ancestors = new $();
|
|
1017
1049
|
}
|