https://github.com/fault2004/dwfweb (example website)
My attempt at creating a very bad 18 line of code markdown static website generator based on POSIX script, powered by smu.
smu is simple and minimal markup language that convert markdown into HTML easily.
dwarf, from Dwarf Fortress (Video game)
The code itself.
#!/bin/sh
# dwfweb, static website generator, fault2004 @ 2023, MIT <https://github.com/fault2004/dwfweb>
[ ! -f smu/smu ] && (cd smu && make); [ -d o ] && rm -rf o; mkdir o; cp -r m o
for pd in p/*; do
p="${pd##*/}"; pe="${p%%.*}"
pn="$(echo "$pe" | cut -c 1,1 | tr '[:lower:]' '[:upper:]')$(echo "$pe" | cut -c2-)"
{
sed "s/TITLE/${pn}/g" header
for pl in p/*; do
P="${pl##*/}"; PE="${P%%.*}"
PN="$(echo "$PE" | cut -c 1,1 | tr '[:lower:]' '[:upper:]')$(echo "$PE" | cut -c2-)"
[ "$PE" != "index" ] && echo "<a id=menu_link href=${PE}.html>${PN}</a>"
done
echo "</div>"
smu/smu p/"$p"
sed "s/DATE/$(date)/g" footer
} > o/"$pe".html
done
You need build tools to building smu from source, dwfweb will build smu for you.
git clone https://github.com/fault2004/dwfweb && cd dwfweb
git submodule update --init
./dwfweb
After that, generated website will be available in 'o' folder
dwfweb created by Supphakit Duanghoy (aka fault2004) under the MIT License.
smu created by Enno T. Boland under the MIT/X Consortium License.
Generated on Tue Apr 9 03:35:28 UTC 2024, https://github.com/fault2004/dwfweb