ttcMD: fixed rx for grid. Oopsie

This commit is contained in:
Emmaline Autumn 2024-03-14 06:24:58 -06:00
parent 4245eff43e
commit 192479020d

View File

@ -37,7 +37,7 @@ TokenIdentifiers.set("grid", {
const closeRx = /\/\[\]/g; const closeRx = /\/\[\]/g;
return search(s, start, end, rx, closeRx); return search(s, start, end, rx, closeRx);
}, },
rx: /(?:\[\])+\n+((?:.|\n)*?)\n+\/\[\]/g, rx: /(?<!\/)(?:\[\])+\n+((?:.|\n)*?)\n+\/\[\]/g,
parse(s) { parse(s) {
const rx = /((?:\[\])+)\n+([\s\S]*)\n+\/\[\]/; const rx = /((?:\[\])+)\n+([\s\S]*)\n+\/\[\]/;
const [_, columns, content] = s.match(rx) || const [_, columns, content] = s.match(rx) ||
@ -291,9 +291,19 @@ TokenIdentifiers.set("hr", {
}, },
}); });
// const p = TokenIdentifiers.get("p"); TokenIdentifiers.set("comment", {
// TokenIdentifiers.clear(); rx: /<!--[\s\S]+?-->/g,
// p && TokenIdentifiers.set("p", p); parse(s) {
return {
content: "",
metadata: { comment: s },
raw: "",
type: "comment",
uuid: crypto.randomUUID(),
rendersContentOnly,
};
},
});
function findMatchingClosedParenthesis( function findMatchingClosedParenthesis(
str: string, str: string,
@ -358,11 +368,12 @@ function search(
const newEnd = findMatchingClosedParenthesis( const newEnd = findMatchingClosedParenthesis(
s, s,
// s.substring(0, end - start),
openRx, openRx,
closeRx, closeRx,
); );
if (newEnd === null) throw Error("BAD BAD BAD BAD"); if (newEnd === null) throw Error("There was an issue finding a closing tag");
end = newEnd + start; end = newEnd + start;