From 2e3e043cae2dabeb9bf4fa57e0e69b022dfe478d Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Sat, 25 Feb 2023 17:07:30 +0100
Subject: Added documentation/website
---
docs/content.js | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 docs/content.js
(limited to 'docs/content.js')
diff --git a/docs/content.js b/docs/content.js
new file mode 100644
index 0000000..4fb7a16
--- /dev/null
+++ b/docs/content.js
@@ -0,0 +1,26 @@
+const code = document.getElementsByTagName("pre")[0]
+
+const fixPath = p => p.replace("/", "_")
+
+const term = t => t
+ .replaceAll(/(\([+-][0-9]+[ubt]?\))/g, "$1")
+ .replaceAll(/(?)(\()/g, "(")
+ .replaceAll(/(\))(?!\<)/g, ")")
+ .replaceAll("[", "[")
+ .replaceAll("]", "]")
+ .replaceAll(/(?$1")
+
+code.innerHTML = code.innerHTML
+ .replaceAll(/^:import std\/(.*) (.*)$/gm, (_, p, s) => `:import std/${p} ${s}`)
+ .replaceAll(/^:input std\/(.*)$/gm, (_, p) => `:input std/${p}`)
+ .replaceAll(/^:test \((.*)\) \((.*)\)$/gm, (_, t1, t2) => `:test (${term(t1)}) (${term(t2)})`)
+ .replaceAll(/^([^:\n<#][^ ]*) (.*)$/gm, (_, d, t) => `${d} ${term(t)}`)
+ .replaceAll(/^# (.*)$/gm, "")
+ .replaceAll(/ ⧗ (.*)\n/g, " ⧗ $1\n")
+
+code.innerHTML = `${code.innerHTML}`
+const lines = code.innerHTML.split(/\n/).length - 1
+for (let i = 0; i < lines; i++) {
+ const cur = code.getElementsByTagName("span")[0]
+ cur.innerHTML += `${i + 1}`
+}
--
cgit v1.2.3