0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-25 23:38:14 +00:00

match regex properly

This commit is contained in:
Víctor Losada Hernández
2026-03-25 11:25:33 +01:00
parent 47b47ff255
commit 5c8a6bc4d3

View File

@@ -29,8 +29,8 @@ export function tokenizeCustomMarkdown(text) {
lines.forEach((lineText, lineNumber) => { lines.forEach((lineText, lineNumber) => {
// --- Page / snippet lines --- // --- Page / snippet lines ---
if (/\\page/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.pageLine }); if (/^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m.test(lineText)) tokens.push({ line: lineNumber, type: customTags.pageLine });
if (/\\snippet/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.snippetLine }); if (/^\\snippet\ .*$/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.snippetLine });
if (/^\\column(?:break)?$/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.columnSplit }); if (/^\\column(?:break)?$/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.columnSplit });
if (/\\snippet/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.snippetBreak }); if (/\\snippet/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.snippetBreak });
@@ -185,7 +185,6 @@ export function tokenizeCustomMarkdown(text) {
to: match.index + match[1].length +1, to: match.index + match[1].length +1,
type: customTags.injection, type: customTags.injection,
}); });
console.log(match);
} }
} }
if (lineText.includes("{{") && lineText.includes("}}")) { if (lineText.includes("{{") && lineText.includes("}}")) {