diff options
| author | Taylan Kammer <taylan.kammer@gmail.com> | 2026-05-25 12:14:37 +0200 |
|---|---|---|
| committer | Taylan Kammer <taylan.kammer@gmail.com> | 2026-05-25 12:16:14 +0200 |
| commit | 82621ba5620788ce24aa8db089b4beb9910d9bd6 (patch) | |
| tree | 7df75fba8341c9a7a7f7de7f496177939dbd3fdd | |
| parent | 4b9213d9addd6315de73747a0fdd7e996ba2826a (diff) | |
html/gen.sh -> update-html.sh
| -rwxr-xr-x | html/gen.sh | 60 | ||||
| -rwxr-xr-x | update-html.sh | 49 |
2 files changed, 49 insertions, 60 deletions
diff --git a/html/gen.sh b/html/gen.sh deleted file mode 100755 index cedc4b2..0000000 --- a/html/gen.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -if [ "$(pwd)" != "$HOME/src/zisp/html" ] -then - echo >&2 "Call this from within the Zisp HTML directory." - exit 1 -fi - -md2ht() { - src=$1 - dst=$2 - if ! [ -f "$src" ] - then - echo >&2 "File not found: $src" - continue - fi - echo "$src -> $dst" - { - title=$(sed 's/# //; s/&/\\&/; q' "$src") - sed "s/__TITLE__/$title/" prelude.html - echo "<body>" - markdown2 "$src" -x fenced-code-blocks,highlightjs-lang,tables - echo "</body>" - } > "$dst" -} - -md2ht index.md zisp/index.html -cp style.css zisp/ - -for file in ../notes/*.md -do - name=${file#../notes/} - name=${name%.md} - md2ht "$file" "zisp/notes/$name.html" -done - -shopt -s globstar - -for file in ../docs/**/*.md -do - name=${file#../docs/} - name=${name%.md} - dir=${file#../} - dir=${dir%/*} - mkdir -p "zisp/$dir" - md2ht "$file" "zisp/docs/$name.html" -done - -for file in ../docs/**/*.txt -do - dir=${file#../} - dir=${dir%/*} - mkdir -p "zisp/$dir" - dest=zisp/docs/${file#../docs/} - cp "$file" "$dest" -done - -rsync -a zisp tk:/var/www/html diff --git a/update-html.sh b/update-html.sh new file mode 100755 index 0000000..ad27933 --- /dev/null +++ b/update-html.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -euo pipefail + +if [ "$(pwd)" != "$HOME/src/zisp" ] +then + echo >&2 "Call this from within the Zisp source root." + exit 1 +fi + +md2ht() { + src=$1 + dst=$2 + if ! [ -f "$src" ] + then + echo >&2 "File not found: $src" + continue + fi + echo "$src -> $dst" + { + title=$(sed 's/# //; s/&/\\&/; q' "$src") + sed "s/__TITLE__/$title/" html/prelude.html + echo "<body>" + markdown2 "$src" -x fenced-code-blocks,highlightjs-lang,tables + echo "</body>" + } > "$dst" +} + +md2ht html/index.md html/zisp/index.html + +cp html/style.css html/zisp/ + +shopt -s globstar + +for file in notes/*.md docs/**/*.md +do + dest=html/zisp/${file%.md}.html + mkdir -p "${dest%/*}" + md2ht "$file" "$dest" +done + +for file in docs/**/*.txt +do + dest=html/zisp/$file + mkdir -p "${dest%/*}" + cp "$file" "$dest" +done + +rsync -a html/zisp tk:/var/www/html |
