diff options
author | Marvin Borner | 2024-03-10 16:27:07 +0100 |
---|---|---|
committer | Marvin Borner | 2024-03-10 16:27:07 +0100 |
commit | 6ff75104e28d00535392ebeaf66e2e50c57d0d64 (patch) | |
tree | 30696fda1f531640be10a7cf2bc9c5b4fb4fb40c /docs/gensamples.sh | |
parent | 1f2c16ede8cae96b94d5b27785a473d872d60cb5 (diff) |
Added sample page to website
Diffstat (limited to 'docs/gensamples.sh')
-rwxr-xr-x | docs/gensamples.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/gensamples.sh b/docs/gensamples.sh new file mode 100755 index 0000000..704aea5 --- /dev/null +++ b/docs/gensamples.sh @@ -0,0 +1,26 @@ +#!/bin/env bash + +set -e + +rm -rf samples/ && mkdir -p samples/ + +files=$(find ../samples/ -type f -name "*.bruijn" -printf '%h\0%d\0%p\n' | sort -t '\0' -n | awk -F '\0' '{print $3}') +links="" + +prefix="" +for file in $files; do + name=$(echo "$file" | cut -c12-) + _prefix=$(cut -d/ -f1 <<<"$name") + if ! [ "$prefix" = "$_prefix" ]; then + prefix=$_prefix + links="$links\n</ul><h2>$prefix</h2><ul>" + fi + filename=$(sed s@/@_@g <<<"$name") + links="$links\n<li><a href="$filename.html">$name</a></li>" + awk 'NR==FNR { gsub("<", "\\<", $0); gsub(">", "\\>", $0); a[n++]=$0; next } /CONTENT/ { for (i=0;i<n;++i) print a[i]; next } 1' "$file" content.template >"samples/$filename.html" + sed -i -e "s@NAME@$name@g" "samples/$filename.html" +done + +sed -e "s@LINKS@$links@g" samples.template >samples/index.html + +cp res/* code.js content.css index.css code.css samples/ |