Skip to content

Instantly share code, notes, and snippets.

@dmd
Created May 9, 2024 13:10
Show Gist options
  • Save dmd/e6a17582124f529afc0876d9a37d808b to your computer and use it in GitHub Desktop.
Save dmd/e6a17582124f529afc0876d9a37d808b to your computer and use it in GitHub Desktop.
#!/bin/bash
shopt -s extglob
awk 'FNR==1{print ""}1' posts/*AHNS* > AHNS.txt
awk 'FNR==1{print ""}1' posts/*J* > J.txt
awk 'FNR==1{print ""}1' posts/!(*AHNS*|*J*) > US.txt
for i in AHNS US J
#for i in US J
do
python3 -m quopri -d ${i}.txt | sponge ${i}.txt
pandoc -f markdown -t html ${i}.txt -o ${i}.html
sed 's,^<h1,</td></tr><tr><td><h1,;s,/h1>$,/h1></td><td>,' ${i}.html | sponge ${i}.html
cat pandoc.css ${i}.html | python3 dow.py | sponge ${i}.html
wkhtmltopdf -L 20 -R 20 --page-height 10in --page-width 8in ${i}.html ${i}.pdf
# rm ${i}.html
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment