#!env bash
set -euxo pipefail

function cleanup()
{
    # Terminates http.server
    kill $(cat .PID)
    rm .PID
}

trap cleanup EXIT

python3 -m http.server & # starts on port 8000
# $! == PID of last background process
echo $! > .PID





    
        weasyprint  http://localhost:8000/leaflets/2026/llms/  ./leaflets/2026/llms/stochastic-sycophancy-and-its-discontents.view.pdf
        pdfimpose saddle -f letter -o  './leaflets/2026/llms/stochastic-sycophancy-and-its-discontents.zine.pdf' './leaflets/2026/llms/stochastic-sycophancy-and-its-discontents.view.pdf'
    

    
        weasyprint  http://localhost:8000/leaflets/2025/lffc/  ./leaflets/2025/lffc/the-little-free-failure-of-capitalism-or-distributing-socks-to-your-neighbors-for-fun-and-nonprofit.view.pdf
        pdfimpose saddle -f letter -o  './leaflets/2025/lffc/the-little-free-failure-of-capitalism-or-distributing-socks-to-your-neighbors-for-fun-and-nonprofit.zine.pdf' './leaflets/2025/lffc/the-little-free-failure-of-capitalism-or-distributing-socks-to-your-neighbors-for-fun-and-nonprofit.view.pdf'
    

    

    
        weasyprint  http://localhost:8000/leaflets/2025/on249/  ./leaflets/2025/on249/on-249-reflections-on-what-the-usa-could-still-mean.view.pdf
        pdfimpose saddle -f letter -o  './leaflets/2025/on249/on-249-reflections-on-what-the-usa-could-still-mean.zine.pdf' './leaflets/2025/on249/on-249-reflections-on-what-the-usa-could-still-mean.view.pdf'
    

    
        weasyprint  http://localhost:8000/leaflets/2025/cato01/  ./leaflets/2025/cato01/selected-sermons-of-reverend-cato-part-1.view.pdf
        pdfimpose saddle -f letter -o  './leaflets/2025/cato01/selected-sermons-of-reverend-cato-part-1.zine.pdf' './leaflets/2025/cato01/selected-sermons-of-reverend-cato-part-1.view.pdf'
    

    

    
        weasyprint  http://localhost:8000/monographs/weareallveryanxious/  ./monographs/weareallveryanxious/we-are-all-very-anxious.view.pdf
        pdfimpose saddle -f letter -o  './monographs/weareallveryanxious/we-are-all-very-anxious.zine.pdf' './monographs/weareallveryanxious/we-are-all-very-anxious.view.pdf'
    
zip -r fenestrate-press-archive.zip *