fmt: format using shfmt
This commit is contained in:
parent
d4869448fb
commit
e6969ab164
2 changed files with 92 additions and 95 deletions
|
@ -15,7 +15,7 @@ rm -f .md.toml
|
|||
|
||||
# if the user only wants teh html tehn early return
|
||||
if [[ $1 == "html" ]]; then
|
||||
exit 0;
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# recursively parse _Handovers_html use wkhtmltopdf to convert to pdf
|
||||
|
@ -23,30 +23,30 @@ cd _Handovers_html
|
|||
|
||||
out_folder="../_Handovers_pdf"
|
||||
rm -rf "$out_folder"
|
||||
for d in */ ; do
|
||||
# skip symlinks
|
||||
[ -L "''${d%/}" ] && continue
|
||||
# exclude teh template fodler
|
||||
if [[ $d == *"_Templates"* ]]; then
|
||||
continue
|
||||
fi
|
||||
for d in */; do
|
||||
# skip symlinks
|
||||
[ -L "''${d%/}" ] && continue
|
||||
# exclude teh template fodler
|
||||
if [[ $d == *"_Templates"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# create output folder
|
||||
mkdir -p "$out_folder/$d"
|
||||
# create output folder
|
||||
mkdir -p "$out_folder/$d"
|
||||
|
||||
# iterate the files
|
||||
for file in $d*.html; do
|
||||
if [ -f "$file" ]; then
|
||||
# iterate the files
|
||||
for file in $d*.html; do
|
||||
if [ -f "$file" ]; then
|
||||
|
||||
# we need teh filename/path
|
||||
stripped=''${file/.html/""}
|
||||
# we need teh filename/path
|
||||
stripped=''${file/.html/""}
|
||||
|
||||
echo "$out_folder/$stripped.pdf"
|
||||
echo "$out_folder/$stripped.pdf"
|
||||
|
||||
# convert teh html to pdf
|
||||
wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$stripped.html" "$out_folder/$stripped.pdf" 2>> ../errors.log &
|
||||
fi
|
||||
done
|
||||
# convert teh html to pdf
|
||||
wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$stripped.html" "$out_folder/$stripped.pdf" 2>>../errors.log &
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
cd ../
|
|
@ -3,102 +3,99 @@
|
|||
root="$PWD"
|
||||
|
||||
# make teh html files first
|
||||
function build_html(){
|
||||
# wipe and reset teh old html folder
|
||||
rm -rf Minutes_html
|
||||
mkdir Minutes_html
|
||||
function build_html() {
|
||||
# wipe and reset teh old html folder
|
||||
rm -rf Minutes_html
|
||||
mkdir Minutes_html
|
||||
|
||||
# this folder has css and images needed
|
||||
cp -R Minutes/_Templates Minutes_html/
|
||||
# this folder has css and images needed
|
||||
cp -R Minutes/_Templates Minutes_html/
|
||||
|
||||
cd Minutes
|
||||
cd Minutes
|
||||
|
||||
# loop through each year worth of data
|
||||
for year in */ ; do
|
||||
# skip symlinks
|
||||
[ -L "''${year%/}" ] && continue
|
||||
# exclude teh template fodler
|
||||
if [[ $year == *"_Templates"* ]]; then
|
||||
continue
|
||||
fi
|
||||
# loop through each year worth of data
|
||||
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
|
||||
# go into the year folder
|
||||
cd $year
|
||||
|
||||
# convert the Committee ones first
|
||||
cp ../../_scripts/md_toml/_Minutes-Committee.md.toml ./.md.toml
|
||||
cargo-bfom
|
||||
# convert the Committee ones first
|
||||
cp ../../_scripts/md_toml/_Minutes-Committee.md.toml ./.md.toml
|
||||
cargo-bfom
|
||||
|
||||
# then the council
|
||||
cp ../../_scripts/md_toml/_Minutes-Council.md.toml ./.md.toml
|
||||
cargo-bfom
|
||||
# then the council
|
||||
cp ../../_scripts/md_toml/_Minutes-Council.md.toml ./.md.toml
|
||||
cargo-bfom
|
||||
|
||||
# cleanup
|
||||
rm -f .md.toml
|
||||
# cleanup
|
||||
rm -f .md.toml
|
||||
|
||||
# create teh new folders where stuff is going to
|
||||
mkdir -p "../../Minutes_html/$year/Committee"
|
||||
mkdir -p "../../Minutes_html/$year/Council"
|
||||
# create teh new folders where stuff is going to
|
||||
mkdir -p "../../Minutes_html/$year/Committee"
|
||||
mkdir -p "../../Minutes_html/$year/Council"
|
||||
|
||||
# iterate the files
|
||||
for file in {Committee,Council}_html/*.html; do
|
||||
if [ -f "$file" ]; then
|
||||
stripped=''${file/_html/""}
|
||||
cp $file "../../Minutes_html/$year/$stripped"
|
||||
fi
|
||||
done
|
||||
# the temp folders where teh html was created, leaving these could cause ghost artifacts
|
||||
rm -rf ./*_html
|
||||
# iterate the files
|
||||
for file in {Committee,Council}_html/*.html; do
|
||||
if [ -f "$file" ]; then
|
||||
stripped=''${file/_html/""}
|
||||
cp $file "../../Minutes_html/$year/$stripped"
|
||||
fi
|
||||
done
|
||||
# the temp folders where teh html was created, leaving these could cause ghost artifacts
|
||||
rm -rf ./*_html
|
||||
|
||||
# back up to original folder
|
||||
cd ../
|
||||
done
|
||||
# back up to original folder
|
||||
cd ../
|
||||
done
|
||||
|
||||
# return to root
|
||||
cd $root
|
||||
# return to root
|
||||
cd $root
|
||||
}
|
||||
|
||||
function build_pdf() {
|
||||
# used to match **
|
||||
shopt -s globstar
|
||||
|
||||
function build_pdf(){
|
||||
# used to match **
|
||||
shopt -s globstar
|
||||
# wipe and reset past runs
|
||||
rm -rf Minutes_pdf
|
||||
mkdir Minutes_pdf
|
||||
|
||||
# wipe and reset past runs
|
||||
rm -rf Minutes_pdf
|
||||
mkdir Minutes_pdf
|
||||
cd Minutes_html
|
||||
|
||||
cd Minutes_html
|
||||
for file in **/*.html; do
|
||||
# skip teh template folder
|
||||
if [[ $file == *"_Templates"* ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
for file in **/*.html; do
|
||||
# skip teh template folder
|
||||
if [[ $file == *"_Templates"* ]]; then
|
||||
continue
|
||||
fi
|
||||
# only deal with files
|
||||
if [ -f "$file" ]; then
|
||||
|
||||
# only deal with files
|
||||
if [ -f "$file" ]; then
|
||||
# .html => .pdf
|
||||
output="../Minutes_pdf/''${file/.html/".pdf"}"
|
||||
|
||||
# .html => .pdf
|
||||
output="../Minutes_pdf/''${file/.html/".pdf"}"
|
||||
echo $output
|
||||
|
||||
echo $output
|
||||
# have someplace for it to go
|
||||
mkdir -p $(dirname $output)
|
||||
|
||||
# have someplace for it to go
|
||||
mkdir -p $(dirname $output)
|
||||
wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$file" "$output" 2>>../errors.log &
|
||||
fi
|
||||
done
|
||||
|
||||
wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$file" "$output" 2>> ../errors.log &
|
||||
fi
|
||||
done
|
||||
|
||||
shopt -u globstar
|
||||
cd $root
|
||||
shopt -u globstar
|
||||
cd $root
|
||||
}
|
||||
|
||||
|
||||
if [[ $1 == "html" ]];
|
||||
then
|
||||
build_html
|
||||
if [[ $1 == "html" ]]; then
|
||||
build_html
|
||||
else
|
||||
build_html
|
||||
build_pdf
|
||||
build_html
|
||||
build_pdf
|
||||
fi
|
Loading…
Reference in a new issue