@reteps/tree-sitter-htmlmustache 0.5.2 → 0.6.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/cli/out/main.js +14 -9
- package/package.json +1 -1
package/cli/out/main.js
CHANGED
|
@@ -708,9 +708,12 @@ function validateConfig(raw) {
|
|
|
708
708
|
config.mustacheSpaces = obj.mustacheSpaces;
|
|
709
709
|
}
|
|
710
710
|
if (Array.isArray(obj.noBreakDelimiters)) {
|
|
711
|
-
const items =
|
|
712
|
-
|
|
713
|
-
|
|
711
|
+
const items = [];
|
|
712
|
+
for (const entry of obj.noBreakDelimiters) {
|
|
713
|
+
if (entry && typeof entry === "object" && !Array.isArray(entry) && typeof entry.start === "string" && entry.start !== "" && typeof entry.end === "string" && entry.end !== "") {
|
|
714
|
+
items.push({ start: entry.start, end: entry.end });
|
|
715
|
+
}
|
|
716
|
+
}
|
|
714
717
|
if (items.length > 0) config.noBreakDelimiters = items;
|
|
715
718
|
}
|
|
716
719
|
if (Array.isArray(obj.include)) {
|
|
@@ -3280,7 +3283,9 @@ function textWords(str) {
|
|
|
3280
3283
|
}
|
|
3281
3284
|
function collapseDelimitedRegions(parts, delimiters) {
|
|
3282
3285
|
if (delimiters.length === 0) return parts;
|
|
3283
|
-
const sorted = [...delimiters].sort(
|
|
3286
|
+
const sorted = [...delimiters].sort(
|
|
3287
|
+
(a, b) => Math.max(b.start.length, b.end.length) - Math.max(a.start.length, a.end.length)
|
|
3288
|
+
);
|
|
3284
3289
|
const result = [...parts];
|
|
3285
3290
|
let activeDelimiter = null;
|
|
3286
3291
|
for (let i = 0; i < result.length; i++) {
|
|
@@ -3288,10 +3293,10 @@ function collapseDelimitedRegions(parts, delimiters) {
|
|
|
3288
3293
|
if (typeof part === "string") {
|
|
3289
3294
|
if (activeDelimiter === null) {
|
|
3290
3295
|
for (const delim of sorted) {
|
|
3291
|
-
const
|
|
3292
|
-
if (
|
|
3293
|
-
const afterOpen =
|
|
3294
|
-
const closeIdx = part.indexOf(delim, afterOpen);
|
|
3296
|
+
const startIdx = part.indexOf(delim.start);
|
|
3297
|
+
if (startIdx >= 0) {
|
|
3298
|
+
const afterOpen = startIdx + delim.start.length;
|
|
3299
|
+
const closeIdx = part.indexOf(delim.end, afterOpen);
|
|
3295
3300
|
if (closeIdx >= 0) {
|
|
3296
3301
|
continue;
|
|
3297
3302
|
}
|
|
@@ -3300,7 +3305,7 @@ function collapseDelimitedRegions(parts, delimiters) {
|
|
|
3300
3305
|
}
|
|
3301
3306
|
}
|
|
3302
3307
|
} else {
|
|
3303
|
-
if (part.includes(activeDelimiter)) {
|
|
3308
|
+
if (part.includes(activeDelimiter.end)) {
|
|
3304
3309
|
activeDelimiter = null;
|
|
3305
3310
|
}
|
|
3306
3311
|
}
|