#!/usr/bin/env bash # delete to allow for a full rebuild without any ghost artifacts rm -rf "Minutes_pdf" cd Minutes for year in */ ; do # skip symlinks [ -L "''${year%/}" ] && continue # exclude teh template fodler if [[ $year == *"_Templates"* ]]; then continue fi # go into the year folder cd $year # convert the Committee ones first cp ../../_scripts/md_toml/_Minutes-Committee.md.toml ./.md.toml cargo-bfom cp ../../_scripts/md_toml/_Minutes-Council.md.toml ./.md.toml cargo-bfom mkdir -p "../../Minutes_pdf/$year/Committee" mkdir -p "../../Minutes_pdf/$year/Council" # iterate the files for file in {Committee,Council}_html/*.html; do if [ -f "$file" ]; then # we need teh filename/path stripped=''${file/.html/""} output="../../Minutes_pdf/$year${stripped/_html/""}.pdf" echo $output wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$stripped.html" "$output" 2>> ../errors.log fi done # cleanup rm -f .md.toml # the temp folders where teh html was created, leaving these could cause ghost artifacts rm -rf ./*_html done cd ../