$*
EOF
do_title
}
# This function puts out the title with name of manpage
do_title(){
if [ -n "$title" ]
then
echo "$title
"
fi
}
# This function puts out ref to table of contents that
# follows header for all but 1st and toc page.
do_href_toc(){
cat <Table of Contents
EOF
}
# This function puts out ref to previous section
do_href_prev(){
echo "
Previous: $2
"
}
# This function puts out footer needed by all but last page.
do_footer(){
cat <
EOF
}
# This function changes the trailing NAME anchor
# of a section into an href to the next section.
# The first edit is for sections. The second edit
# handles the toc anchor, which has no href and so
# is missed by the first edit.
do_href_next(){
sed -e '$s,^.*]*>\([^<]*\).*$,
Next: \2,' \
-e '$s,]$/N' \
-e 's/\n/ /' \
-e 't top' $1 > $filename
# If user did not supply title, get title for top of
# each page from rman-generated line. If user
# gave a blank title then leave it blank.
if [ -z "$title" -a -z "$notitle" ]
then
title=`sed -e '/^/q' $filename |
sed -n -e 's,^\([^<]*\).*$,\1,p'`
fi
# Get a list of all the sections. Separate it into a
# list of merged sections and a list of all other sections.
# Merged sects are combined and get special treatment besides.
allsects=`sed -n 's,^.*/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
# Create html directory if it does not exist.
if [ -d $htmldir ]
then
echo "Re-using directory $htmldir."
else
echo "Creating directory $htmldir..."
if mkdir $htmldir
then
true
else
echo "Failed!"
exit 1
fi
fi
echo "Creating section pages..."
# Produce index page. It is special, since it combines
# merged sections and uses the rman-generated header.
nextsect=`echo $sectlist | awk '{print $1;}'`
echo $ac_n $mergesects "$ac_c"
(do_title ;
sed -n -e "1,/^ $htmldir/sect0.html
# Produce pages for all other sections except toc.
prevsect="sect$mergesect"
prevtext=`sed -n 's,^\([^<]*\).*$,\1,p' $filename | sed -e 's/ *$//'`
for sect in $sectlist;
do
echo $ac_n "$sect $ac_c"
headtext=`sed -n 's,^\([^<]*\).*$,\1,p' $filename | sed -e 's/ *$//'`
(do_header $headtext ;
do_href_toc ;
do_href_prev "$prevsect" "$prevtext" ;
sed -n -e '/ $htmldir/$sect.html
prevsect="$sect"
prevtext="$headtext"
done
# Produce table of contents
echo "toc"
(do_header Table of Contents ;
sed -n -e '//,$p' $filename | \
change_hrefs ;
) > $htmldir/toc.html
# Finally, make sure the symlinks index.html and
# sect1.html -> sect0.html are in place, and if not,
# create them. If --tocfirst is not specified, then
# link index.html to section 0, otherwise link it to
# index.html
echo "Doing symlinks..."
cd $htmldir
rm -f index.html
if [ -z "$tocfirst" ]
then
echo "Linking index.html -> sect0.html"
ln -s sect0.html index.html
else
echo "Linking index.html -> toc.html"
ln -s toc.html index.html
fi
for sect in $mergesects
do
if [ "$sect" != "sect0" ]
then
echo "Linking $sect.html -> sect0.html"
rm -f $sect.html
ln -fs sect0.html $sect.html
fi
done
echo "Done."