web/scripts/web.sh
rvba 701a3542b3
All checks were successful
/ publish (push) Successful in 1m0s
Actualiser scripts/web.sh
2025-02-25 21:55:13 +01:00

47 lines
682 B
Bash
Executable file

#!/bin/bash
html_template="default.html"
css_template="default.css"
convert()
{
file=$1
filename=$(basename -- "$file")
extension="${filename##*.}"
filename="${filename%.*}"
if [[ -f ../pages/$filename.md ]]
then
echo "making $filename.html"
pandoc \
-s \
--verbose \
--template=templates/$html_template \
--css=$css_template \
../pages/$filename.md \
-t html > ../dist/$filename.html
#--lua-filter=links-to-html.lua
fi
}
batch()
{
files=$(ls ../pages)
for f in $files
do
echo "$f"
convert $f
done
}
# Linked files
cp templates/* ../dist
# Options
case $1 in
convert) shift 1; convert "$@";;
batch) batch ;;
*) echo "?" ;;
esac