From e7bff2495c2ce2b7c1dd01061616bf9e067f469c Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 19 Apr 2021 11:59:47 -0300 Subject: move textOnly tag test before advancing past "[[" This makes syntax error messages a little nicer, i.e. hello there [[album:[[lol]]]] --------------------^ instead of hello there [[album:[[lol]]]] ----------------------^ --- upd8.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/upd8.js b/upd8.js index de6af97..e425cb7 100755 --- a/upd8.js +++ b/upd8.js @@ -1066,6 +1066,9 @@ const replacerSpec = { i = closestMatchIndex; pushTextNode(); + if (textOnly && closestMatch === tagBeginning) + throw makeError(i, `Unexpected [[tag]] - expected only text here.`); + i += closestMatch.length; if (closestMatch !== tagBeginning) { @@ -1077,9 +1080,6 @@ const replacerSpec = { } if (closestMatch === tagBeginning) { - if (textOnly) - throw makeError(i, `Unexpected [[tag]] - expected only text here.`); - const iTag = closestMatchIndex; let N; -- cgit 1.3.0-6-gf8a5