Remove debugging aid
[llpp.git] / misc / llpphtml
blob2c0ccf9680f7d5d09b54cc7c4e33af5b72e1909e
1 #!/bin/sh
2 set -e
4 die() { echo "$1" >&2; exit 1; }
6 cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/llpp"
7 test -d "$cachedir" || die "cache directory '$cachedir' does not exist"
9 command -v prince >/dev/null 2>&1 || { die "$0: need princeXML to work"; }
11 css=$HOME/xsrc/llpp/misc/prince.css
12 test -e "$css" || unset css
13 while getopts c:f opt; do
14 case $opt in
15 c) css="$OPTARG";;
16 f) force=true;;
17 ?) die "usage: $0 [-c css] url";;
18 esac
19 done
20 shift $(($OPTIND - 1))
21 test -z "$1" && die "usage $0: url"
23 url="$1"
24 set -- $(echo "$url" | md5sum)
25 pdf="$cachedir/$1.pdf"
27 ${force-$(test ! -e "$pdf")} && prince ${css:+--style $css} -o "$pdf" "$url"
28 exec llpp -layout-height 0 -origin "$url" "$pdf"