fix: description placeholder sentinel leaking to output

Two bugs:
1. Sentinel used double-underscore delimiters (__DESC:id__) — fragile regex
   [^_]+ would break on IDs containing underscores, and Pass-1 output
   containing sentinels would leak through Pass 2 unstripped.
2. After Pass 2 substitution, sentinels inside substituted text (from
   Pass-1 output of the referenced id) were never cleaned up.

Fix: switch to null-byte delimiters (\x00DESC:id\x00) which cannot appear
in user text, and add a second .replace(SENTINEL_RE, '') pass to strip any
sentinels that survive after substitution (self-refs, nested cycles).
This commit is contained in:
Falkan
2026-03-18 19:51:01 -04:00
parent 1204ede140
commit d332cc135e
2 changed files with 45 additions and 46 deletions

View File

@@ -6,7 +6,8 @@
"labelPlural": "pounds",
"symbol": "lb",
"group": "dickloads",
"toBase": 0.038
"toBase": 0.038,
"description": "{dickload:description}"
},
{
"id": "dickload",
@@ -14,7 +15,8 @@
"labelPlural": "dickloads",
"symbol": "dl",
"group": "dickloads",
"toBase": 1
"toBase": 1,
"description": "See {pound:description}"
},
{
"id": "barrel",
@@ -69,24 +71,24 @@
},
{
"id": "assload",
"label": "Assload",
"labelPlural": "Assloads",
"label": "assload",
"labelPlural": "assloads",
"symbol": "assl",
"group": "dickloads",
"toBase": 2
},
{
"id": "shitload",
"label": "Shitload",
"labelPlural": "Shitloads",
"label": "shitload",
"labelPlural": "shitloads",
"symbol": "shtld",
"group": "dickloads",
"toBase": 12.6666666667
},
{
"id": "shit-ton",
"label": "Shit ton",
"labelPlural": "Shit tons",
"label": "shit ton",
"labelPlural": "shit tons",
"symbol": "shttn",
"group": "dickloads",
"toBase": 38