summaryrefslogtreecommitdiff
path: root/eeshow-viewer
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-10-17 04:57:06 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-10-17 04:57:06 (GMT)
commitb4187f66439d75ca03b5f84824918bee04483545 (patch)
treeb62bfd60d9bac7c17ad3ea9bbfe7f73e36127530 /eeshow-viewer
parent185403c681c9c6b57de7ddb31091541b81683d44 (diff)
downloadeeshow-b4187f66439d75ca03b5f84824918bee04483545.zip
eeshow-b4187f66439d75ca03b5f84824918bee04483545.tar.gz
eeshow-b4187f66439d75ca03b5f84824918bee04483545.tar.bz2
eeshow-viewer: support url#page for PDF when using xpdf or evince
Diffstat (limited to 'eeshow-viewer')
-rwxr-xr-xeeshow-viewer22
1 files changed, 19 insertions, 3 deletions
diff --git a/eeshow-viewer b/eeshow-viewer
index f549160..fd84ea1 100755
--- a/eeshow-viewer
+++ b/eeshow-viewer
@@ -57,11 +57,27 @@ fi
[ "$1" ] || exit 0
-hash=`echo -n "$1" | tr -c '[[:alnum:].\-]' _`
+url=${1%\#[0-9]*}
+page=
+if [ "$url" != "$1" ]; then
+ page=${1##*#}
+fi
+
+hash=`echo -n "$url" | tr -c '[[:alnum:].\-]' _`
file=$dir/$hash
if [ ! -r "$file" ]; then
- wget -O "$file" "$1" || { rm -f "$file"; exit 1; }
+ wget -O "$file" "$url" || { rm -f "$file"; exit 1; }
fi
$cache_only && exit
-${EESHOW_VIEWER_VIEWER:-xdg-open} "$file"
+
+if [ "$page" ]; then
+ v=${EESHOW_PDF_VIEWER:-${PDF_VIEWER:-xdg-open}}
+ case "$v" in
+ *xpdf) "$v" "$file" "$page";;
+ *evince)"$v" --page-index="$page" "$file";;
+ *) "$v" "$file";;
+ esac
+else
+ ${EESHOW_VIEWER_VIEWER:-xdg-open} "$file"
+fi