1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-12-23 13:48:03 +00:00
dotfiles/bin/nse

14 lines
379 B
Bash
Executable file

#!/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