fix: port some ideas across to teh minutes script

This commit is contained in:
silver 2024-05-19 21:35:02 +01:00
parent 1676c6fc25
commit 9e0b434430
Signed by untrusted user: silver
GPG key ID: 54E2C71918E93B74

View file

@ -2,14 +2,17 @@
root="$PWD" root="$PWD"
folder_html="Minutes_html"
folder_pdf="Minutes_pdf"
# make teh html files first # make teh html files first
function build_html() { function build_html() {
# wipe and reset teh old html folder # wipe and reset teh old html folder
rm -rf Minutes_html rm -rf "$folder_html"
mkdir Minutes_html mkdir "$folder_html"
# this folder has css and images needed # this folder has css and images needed
cp -R Minutes/_Templates Minutes_html/ cp -R Minutes/_Templates "$folder_html/"
cd Minutes cd Minutes
@ -37,14 +40,14 @@ function build_html() {
rm -f .md.toml rm -f .md.toml
# create teh new folders where stuff is going to # create teh new folders where stuff is going to
mkdir -p "../../Minutes_html/$year/Committee" mkdir -p "../../$folder_html/$year/Committee"
mkdir -p "../../Minutes_html/$year/Council" mkdir -p "../../$folder_html/$year/Council"
# iterate the files # iterate the files
for file in {Committee,Council}_html/*.html; do for file in {Committee,Council}_html/*.html; do
if [ -f "$file" ]; then if [ -f "$file" ]; then
stripped=''${file/_html/""} stripped=''${file/_html/""}
cp $file "../../Minutes_html/$year/$stripped" cp $file "../../$folder_html/$year/$stripped"
fi fi
done done
# the temp folders where teh html was created, leaving these could cause ghost artifacts # the temp folders where teh html was created, leaving these could cause ghost artifacts
@ -63,22 +66,17 @@ function build_pdf() {
shopt -s globstar shopt -s globstar
# wipe and reset past runs # wipe and reset past runs
rm -rf Minutes_pdf rm -rf "$folder_pdf"
mkdir Minutes_pdf mkdir "$folder_pdf"
cd Minutes_html cd "$folder_html"
for file in **/*.html; do for file in **/*.html; do
# skip teh template folder
if [[ $file == *"_Templates"* ]]; then
continue
fi
# only deal with files # only deal with files
if [ -f "$file" ]; then if [ -f "$file" ]; then
# .html => .pdf # .html => .pdf
output="../Minutes_pdf/${file/.html/".pdf"}" output="../$folder_pdf/${file/.html/".pdf"}"
echo $output echo $output