1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-11-09 00:14:53 +00:00
dotfiles/bin/nse

14 lines
401 B
Plaintext
Raw Normal View History

#!/bin/sh
d=$(mktemp -d)
bsdtar xf "$@" -C"$d"
t=$(fd -e ncx . "$d")
xml_grep content "$t" | uniq | grep content | cut -d\" -f2 |\
sed -e 's#.*#<a href="&">&</a><br />#' -e 's#">[^/<]*/#">#'\
-e 's/\.xhtml/\.html/g' > "$(dirname "$t")"/index.html
fd -e xhtml . "$d" -x mv {} '{.}'.html
if test -z "$BROWSER"; then
BROWSER=netsurf
fi
eval $BROWSER "$(dirname "$t")"/index.html
rm -rf "$d"