open-goverance/_scripts/format_minutes.sh
Brendan Golden 04b9be1fbc
fix: turns out wkhtmltopdf has been depreciated for two years
It was running on a version of QT4 that hadnt gotten a browser update since 2015.
See https://wkhtmltopdf.org/status.html for more info

Its a shame to use a chrome based renderer for this but I would rather have somethign that would work
At least we got teh nix cache out of this though
2024-05-13 15:00:36 +01:00

52 lines
No EOL
1.1 KiB
Bash
Executable file

#!/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
puppeteer print "$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 ../