citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit 3a1522c9a4a69083b867f2cf5e599ec8a61e1883
parent 070b4f2f16e934f68e42e5ee6dc83f920c26b720
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 19 Sep 2020 05:07:43 -0700

bin/pdfnow: fixes

Diffstat:
Mbin/pdfnow | 20+++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/bin/pdfnow b/bin/pdfnow @@ -1,23 +1,21 @@ #!/usr/bin/env bash -#PANDOC='pandoc --metadata=fontfamily:libertine' -PANDOC='pandoc --metadata=fontfamily:libertine -V geometry:margin=1.2in --variable urlcolor=cyan' - usage () { - printf "usage: pdfnow file.md OR <file.md pdfnow markdown\n" >&2 + printf "usage: pdfnow file.md OR <file.md pdfnow [markdown]\n" >&2 exit 1 } -[ $# -eq 0 ] && usage +outfile=${1:-"$(mktemp)".pdf} if [ -t 0 ]; then [ $# -eq 0 ] && usage - $PANDOC "$@" -o /tmp/out.pdf + /home/jb55/bin/pdfsave "$1" "$outfile" else - [ $# -eq 0 ] && usage - ext="$1" - shift - $PANDOC "$@" -f "$ext" -o /tmp/out.pdf + outfile="$(mktemp)".pdf + ext="${1:-markdown}" + /home/jb55/bin/pdfsave "$outfile" "$ext" fi -zathura /tmp/out.pdf &>/dev/null +zathura "$outfile" &>/dev/null + +rm "$outfile"