aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2024-03-10 20:45:08 +0100
committerMarvin Borner2024-03-10 20:49:10 +0100
commitf0b836a87f25939f593632381409743623bf9cb7 (patch)
tree548b5c390d5e2c79104691edb2528470fb5d7702
parent4e680c5523218fb2a5359dae351a692e2d13d2e8 (diff)
Better std UI
-rwxr-xr-xdocs/gensamples.sh2
-rwxr-xr-xdocs/genstd.sh11
-rw-r--r--std/Logic.bruijn2
-rw-r--r--std/Logic/Ternary.bruijn2
4 files changed, 12 insertions, 5 deletions
diff --git a/docs/gensamples.sh b/docs/gensamples.sh
index 704aea5..1734e0a 100755
--- a/docs/gensamples.sh
+++ b/docs/gensamples.sh
@@ -9,7 +9,7 @@ links=""
prefix=""
for file in $files; do
- name=$(echo "$file" | cut -c12-)
+ name=$(cut -c12- <<<"$file")
_prefix=$(cut -d/ -f1 <<<"$name")
if ! [ "$prefix" = "$_prefix" ]; then
prefix=$_prefix
diff --git a/docs/genstd.sh b/docs/genstd.sh
index e028da8..a766826 100755
--- a/docs/genstd.sh
+++ b/docs/genstd.sh
@@ -4,11 +4,18 @@ set -e
rm -rf std/ && mkdir -p std/
-files=$(find ../std/ -type f -printf '%h\0%d\0%p\n' | sort -t '\0' -n | awk -F '\0' '{print $3}')
+files=$(find ../std/ -type f -name "*.bruijn" -printf '%h\0%d\0%p\n' | sort -t '\0' -n | awk -F '\0' '{print $3}')
links=""
+prefix="seeelefant"
for file in $files; do
- name=$(echo "$file" | cut -c8-)
+ name=$(cut -c8- <<<"$file")
+ _prefix=$(cut -c8- <<<"$file" | sed -rn 's@^(.*)/.*$@\1@p')
+ echo "$_prefix"
+ if ! [ "$prefix" = "$_prefix" ]; then
+ prefix=$_prefix
+ links="$links\n</ol><h2>std/$prefix</h2><ol>"
+ fi
filename=$(sed s@/@_@g <<<"$name")
links="$links\n<li><span class='com'>:import</span> <a href="$filename.html">$name</a></li>"
awk 'NR==FNR { gsub("<", "\\&lt;", $0); gsub(">", "\\&gt;", $0); a[n++]=$0; next } /CONTENT/ { for (i=0;i<n;++i) print a[i]; next } 1' "$file" content.template >"std/$filename.html"
diff --git a/std/Logic.bruijn b/std/Logic.bruijn
index 171b52b..697ce23 100644
--- a/std/Logic.bruijn
+++ b/std/Logic.bruijn
@@ -1,4 +1,4 @@
# MIT License, Copyright (c) 2024 Marvin Borner
# this is just a reference to the boolean implementation
-:input std/Logic/Binary .
+:input std/Logic/Binary
diff --git a/std/Logic/Ternary.bruijn b/std/Logic/Ternary.bruijn
index 71fb5ac..883334e 100644
--- a/std/Logic/Ternary.bruijn
+++ b/std/Logic/Ternary.bruijn
@@ -1,4 +1,4 @@
-# MIT License, Copyright (c) 2023 Marvin Borner
+# MIT License, Copyright (c) 2024 Marvin Borner
# true
true [[[0]]]