From: Lady <redacted>
Date: Fri, 28 Jul 2023 08:38:21 +0000 (-0700)
Subject: Add symbol substitutions
X-Git-Tag: 0.1.2~1
X-Git-Url: https://git.ladys.computer/GitWikiWeb/commitdiff_plain/d6baabd2ed44753aa5220830aae7741bd2cf8c28?ds=sidebyside

Add symbol substitutions
---

diff --git a/build.js b/build.js
index 0544a03..b0df7c0 100644
--- a/build.js
+++ b/build.js
@@ -471,6 +471,35 @@ class GitWikiWebPage {
           },
           exit: (_) => {},
         },
+        symb: {
+          enter: (e) => {
+            const { alias } = e;
+            const codepoint = /^U\+([0-9A-Fa-f]+)$/u.exec(alias)?.[1];
+            if (codepoint) {
+              return str`${
+                String.fromCodePoint(parseInt(codepoint, 16))
+              }`;
+            } else {
+              return {
+                "--8": str`${"—\u2060:\u202F"}`, // reverse puppyprick
+                "8--": str`${"\u202F:\u2060—"}`, // forward puppyprick
+                sp: rawInline` `, // space
+                nbsp: str`${"\xA0"}`, // no‐break space
+                cgj: str`${"\u034F"}`, // combining grapheme joiner
+                ensp: str`${"\u2002"}`, // enspace
+                emsp: str`${"\u2003"}`, // emspace
+                figsp: str`${"\u2007"}`, // figure space
+                zwsp: str`${"\u200B"}`, // zero‐width space
+                zwnj: str`${"\u200C"}`, // zero‐width nonjoiner
+                zwj: str`${"\u200D"}`, // zero‐width joiner
+                nnbsp: str`${"\u202F"}`, // narrow no‐break space
+                mathsp: str`${"\u205F"}`, // math space
+                wj: str`${"\u2060"}`, // word joiner
+                fwsp: str`${"\u3000"}`, // fullwidth space
+              }[alias] ?? e;
+            }
+          },
+        },
       };
     });
     Object.defineProperties(this, {