web/scripts/web.sh

48 lines
699 B
Bash
Raw Permalink Normal View History

2024-12-03 15:26:11 +01:00
#!/bin/bash
2024-12-07 18:38:30 +01:00
html_template="default.html"
css_template="default.css"
2024-12-05 12:13:39 +01:00
convert()
{
file=$1
filename=$(basename -- "$file")
extension="${filename##*.}"
filename="${filename%.*}"
if [[ -f ../pages/$filename.md ]]
then
echo "making $filename.html"
2024-12-07 15:12:42 +01:00
pandoc \
-s \
2024-12-07 15:48:05 +01:00
--verbose \
2024-12-07 18:38:30 +01:00
--template=templates/$html_template \
--css=$css_template \
2024-12-07 15:12:42 +01:00
../pages/$filename.md \
-t html > ../dist/$filename.html \
--lua-filter=links-to-html.lua
2024-12-05 12:13:39 +01:00
fi
}
2024-12-05 12:32:45 +01:00
batch()
{
files=$(ls ../pages)
for f in $files
do
echo "$f"
convert $f
done
}
2024-12-07 15:48:05 +01:00
# Linked files
2024-12-07 18:38:30 +01:00
cp templates/$css_template ../dist
2024-12-07 15:48:05 +01:00
# Options
2024-12-05 12:13:39 +01:00
case $1 in
convert) shift 1; convert "$@";;
2024-12-05 12:32:45 +01:00
batch) batch ;;
2024-12-05 12:13:39 +01:00
*) echo "?" ;;
esac
2024-12-03 15:26:11 +01:00