1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#! /bin/sh -e
# elaborate man2html and do not depend on whether perl is in /usr/bin or
# /usr/local/bin
# Copyright (c) 2004 by Rhyolite Software
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE
# BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# Rhyolite Software DCC 1.2.74-1.16 $Revision$
MAN2HTML=misc/man2html
OFILE=/dev/null
TFILE=/tmp/dccman2html.$$
USAGE="`basename $0`: [-x] [-m man2html] [-t name] [-o ofile]"
while getopts "xm:t:o::" c; do
case $c in
x) set -x; DEBUG=-x;;
m) MAN2HTML=$OPTARG;;
t) Title="$OPTARG.8"; exec < $OPTARG.0;;
o) OFILE=$OPTARG;;
*) echo "$USAGE" 1>&2; exit 1;;
esac
done
shift `expr $OPTIND - 1 || true`
if test "$#" -ne 0; then
echo "$USAGE" 1>&2
exit 1
fi
trap "/bin/rm -f $TFILE" 0 1 2 15
BURL=http://www.rhyolite.com/
perl $MAN2HTML -botm 0 -topm 0 -Title "$Title" \
-cgiurlexp '(($TITLE = ${title}) =~ tr/A-Z/a-z/, $TITLE).".html"' \
| sed \
-e '# remove HTTP references to non-DCC man pages' \
-e 's@<\(A HREF="cdcc.html"\)@<Z\1@g' \
-e 's@<\(A HREF="dbclean.html"\)@<Z\1@g' \
-e 's@<\(A HREF="dblist.html"\)@<Z\1@g' \
-e 's@<\(A HREF="dcc[dm]*.html"\)@<Z\1@g' \
-e 's@<\(A HREF="cdcc.html"\)@<Z\1@g' \
-e 's@<\(A HREF="dccproc.html"\)@<Z\1@g' \
-e 's@<\(A HREF="dccifd.html"\)@<Z\1@g' \
-e 's@<\(A HREF="dccsight.html"\)@<Z\1@g' \
-e 's@<A HREF="[^>]*>\([^<]*\)</A>@\1@g' \
-e 's@<ZA HREF=@<A HREF=@g' \
-e '# remove useless tags' \
-e 's@</B> <B>@ @g' \
-e '# add anchor names to sections' \
-e 's@^\( \)\(<B>\)\([^<]*\)</B>$@\1<A NAME="\3">\2\3</B></A>@' \
-e 's@\(<A NAME="[^"]*\)</*B>@\1@g' \
-e 's@\(<A NAME="[^"]*\)</*B>@\1@g' \
-e 's@^\(<H[0-9]>\)\([^<]*\)@\1<A NAME="\2">\2</A>@' \
-e '# add anchor names to option definitions' \
-e '/NAME="DESCRIPTION"/,/NAME=FILES"/s@^ <B>-\([-_a-zA-Z0-9]\)</B>@ <A NAME="OPTION-\1"><B>-\1</B></A>@' \
-e '# add anchor names to cdcc operations' \
-e '/NAME="OPERATIONS"/,/NAME="FILES"/s@^ <B>\([-_a-zA-Z0-9 ]*\)</B>@ <A NAME="OPERATION-\1"><B>\1</B></A>@' \
-e '# add anchor names to file descriptions' \
-e '/NAME="FILES"/,$s@^ \([a-zA-Z0-9_/.]\{1,\}\)@ <A NAME="FILE-\1">\1</A>@' \
-e '# convert blanks in anchor names to dashes' \
-e 's/\(<A NAME="[^"]*\) /\1-/g' \
-e 's/\(<A NAME="[^"]*\) /\1-/g' \
-e 's/\(<A NAME="[^"]*\) /\1-/g' \
-e 's/\(<A NAME="[^"]*\) /\1-/g' \
-e 's/\(<A NAME="[^"]*\) /\1-/g' \
-e 's/\(<A HREF="[^"]*\) /\1-/g' \
-e 's/\(<A HREF="[^"]*\) /\1-/g' \
-e 's/\(<A HREF="[^"]*\) /\1-/g' \
-e 's/\(<A HREF="[^"]*\) /\1-/g' \
-e 's/\(<A HREF="[^"]*\) /\1-/g' \
-e '# replace reference the Rhyolite Software with URL' \
-e 's@Rhyolite Software@<A HREF="'$BURL'">&</A>@' \
-e 's@'$BURL'\(">[^<]*</A>\)[, ]*\('$BURL'[^ ]*\)@\2\1@' \
-e '# make references to HTML documents in .8 files into links' \
-e 's@INSTALL.html@<A HREF="&">&</A>@' \
> $TFILE
cp $TFILE $OFILE
|