From 327fede0fbcdd7a2f85074907df8dd3c5f58f04a Mon Sep 17 00:00:00 2001 From: Florian Warzecha Date: Fri, 10 May 2024 23:01:11 +0200 Subject: [PATCH] build: experiment: create static html from markdown --- .gitignore | 1 + make_static.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 .gitignore create mode 100755 make_static.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89f9ac0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +out/ diff --git a/make_static.sh b/make_static.sh new file mode 100755 index 0000000..5b5d37b --- /dev/null +++ b/make_static.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# TODO: use nix shebang?! + +if [ -d out ] +then + echo "ERROR: out already exists" + exit 1 +fi + +mkdir out +find . -type d '!' -path './.git/*' '!' -name .git '!' -name out '!' -path './out/*' '!' -name '.' -exec mkdir 'out/{}' ';' +find . -type f -name '*.md' '!' -path './out/*' -exec bash -c 'i="$1"; pandoc -f markdown -s -t html "$i" > $(echo "out/${i%.md}.html")' sh {} ';' +(cd out && tree -o index.html -H .)