repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

fix skill check validation

555d4b694adf28e3db8b133b3b05f02b33306d40

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (1)

scripts/check_skills.mjs

Modified
45 45 return trimmed;
48 +function readIndented(lines, index) {
49 + const block = [];
50 + while (index + 1 < lines.length && /^\s+/.test(lines[index + 1]))
51 + block.push(lines[++index].trim());
52 + return [block, index];
48 55 function parseFrontmatter(lines) {
49 56 const data = {};
50 57 for (let i = 0; i < lines.length; i++) {
52 59 const match = /^(\w[\w-]*):(?:\s*(.*))?$/.exec(line);
53 60 if (!match) continue;
54 61 const [, key, raw = ""] = match;
55 - if (raw.trim() === ">" || raw.trim() === "|") {
56 - const block = [];
57 - while (i + 1 < lines.length && /^\s+/.test(lines[i + 1]))
58 - block.push(lines[++i].trim());
59 - data[key] = block.join(raw.trim() === ">" ? " " : "\n");
62 + const value = raw.trim();
63 + if (value === ">" || value === "|") {
64 + const [block, next] = readIndented(lines, i);
65 + i = next;
66 + data[key] = block.join(value === ">" ? " " : "\n");
67 + } else if (!value && i + 1 < lines.length && /^\s+/.test(lines[i + 1])) {
68 + const [block, next] = readIndented(lines, i);
69 + i = next;
70 + data[key] = unquote(block.join(" "));
60 71 } else {
61 72 data[key] = unquote(raw);