#!/bin/sh # Automatically invoke plucker on a local HTML file or zip file -- in # particular, this should do a decent job on the Baen book zipfiles. # Adam Sampson # # Note that plucker-spider is a symlink to plucker's Spider.py on my machine. tempdir="/tmp/plucktmp.$$" trap "rm -rf $tempdir" 0 find_index () { for name in "$tempdir/index.html" "$tempdir/index.htm" "$tempdir/default.htm" "$tempdir"/*_toc.htm ; do if [ -f "$name" ] ; then echo $name return fi done echo >&2 "Cannot find index" exit 1 } for fn in "$@"; do case "$fn" in *.zip) mkdir -p $tempdir unzip -d $tempdir "$fn" fn="`find_index`" ;; esac dir="`dirname \"$fn\"`" out="`basename \"$fn\" | sed -e 's, ,_,g' -e 's,\.[^\.]*$,,' -e 's,^\(....................\).*,\1,'`" plucker-spider \ -M3 \ --stayonhost \ -f "$out" "$fn" rm -rf $tempdir done