jardinBit/build.sh

44 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# genera sitio:
# ./build.sh
# re-genera sitio:
# ./build.sh all
dir="agenda"
titulo="🍃 jardínBit"
for f in $(find src/ -iname "*md")
do
nombrehtml=$(basename $f md)html
d=$(dirname $f)
if [ $d = "src" ] # archivos root
then
pathhtml="site/${nombrehtml}"
if [ $nombrehtml = "index.html" ]
then
echo "convirtiendo ${f} a ${pathhtml}..."
pandoc -H "src/estilo.html" -B "${d}/nav.html" -A "${d}/footer.html" -f markdown -t html5 -s --toc --toc-depth=2 -o $pathhtml $f
continue
fi
else
dir=${d#src/} # quita prefijo src/
pathhtml="site/${dir}/${nombrehtml}"
fi
if [[ $1 = "all" || $f -nt $pathhtml ]]
then
echo "convirtiendo ${f} a ${pathhtml}..."
if [[ $dir == "agenda" ]]
then
pandoc -H "src/estilo.html" -H "${d}/head.html" -T "$titulo" -B "${d}/nav.html" -A "${d}/footer.html" -f markdown -t html5 -s --toc --toc-depth=2 -o $pathhtml $f
else
pandoc -H "src/estilo.html" -H "${d}/head.html" -T "$titulo" -B "${d}/nav.html" -A "${d}/footer.html" -f markdown -t html5 -s --toc --toc-depth=3 --number-sections -o $pathhtml $f
fi
fi
done
echo "actualizando imágenes..."
rsync -az src/img/ site/img/
echo "ya quedó!"