summaryrefslogtreecommitdiff
path: root/bin/generate_html_windex
blob: 981f73f9bd2633f275db0aaa619d01a00d32332f (plain)
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
#!/bin/sh

# $Id$

# Author:  Ossama Othman <othman@cs.wustl.edu>

# This script generates an HTML windex file from a given list of man pages.
# It is meant to be a replacement for platforms that do not have a
# "catman -w" equivalent command.  No intermediate windex file is necessary.

# SED ans AWK expressions derived from man2html related scripts in the
# same directory this script is found in.

set -e

HTML_WINDEX="acewindex.html"

echo Generating ACE HTML manual page index: $HTML_WINDEX.

rm -f $HTML_WINDEX

cat > $HTML_WINDEX <<EOF
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <title>ACE Manual Page Index</title>
  </head>

  <body text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
    <center><h1>ACE Manual Page Index</h1></center>

 <p>

 This file has been generated from the <A
 HREF="http://www.cs.wustl.edu/~schmidt/ACE_wrappers/man/man3/">manual pages</A>
 in the <A
 HREF="http://www.cs.wustl.edu/~schmidt/ACE.html">ACE</A> package and
 it contains a list of pointers to the manual pages generated by the
 <A HREF="http://www.cs.wustl.edu/~schmidt/ACE_wrappers/bin/README.html">OSE
 documentation tools</A>.

 <p>
 <HR>
 <UL>
EOF

for p in $@; do
  file=`basename $p`
  man_page=`echo $file | sed -e 's/\.[0-9]$//'`
  entry=`echo $file | sed -e 's/\./ /' -e 's/[0-9]$/(\0)/'`
  description=`cat $p | awk '/^.SH.*NAME.*$/ {getline;while ( $0 !~ /\.[a-zA-Z]+.*/ ) {getline; if ($0 !~  /\.[a-zA-Z]+.*/ ) print}}' | \
        sed  -e 's/\\-/-/g' \
             -e 's/\\ / /g' \
             -e 's/\\\//g' \
             -e 's/\\[0&]/  /g' \
             -e 's/&/\&amp;/g' \
             -e 's/</\&lt;/g' \
             -e 's/>/\&gt;/g' \
             -e 's/\\|//g' \
             -e 's^\\fB\([^\\]*\)\\fR^<B>\1</B></I>^g' \
             -e 's^\\f(CO\(.[^\\]*\)\\fR^<CODE>\1</CODE>^g' \
             -e 's^\\fI\(.[^\\]*\)\\fR^<I>\1</I></B>^g' \
             -e 's^\\fB^<B>^g' \
             -e 's^\\f(CO^<CODE>^g' \
             -e 's^\\fI^<I>^g' \
             -e 's^\\f[RP]^</B></I></CODE>^g' \
             -e 's/^\.RS.*/<UL>/' \
             -e 's$^\.RE.*$</UL>$' \
             -e '/^\.[a-zA-Z]*.*/d'`

  echo "<li><a HREF =\"html/$man_page.html\">$entry</a> $description</li>" >> $HTML_WINDEX

done

cat >> $HTML_WINDEX <<EOF
</UL>

    <hr>
EOF

echo Last modified: `date` >> $HTML_WINDEX

cat >> $HTML_WINDEX <<EOF
  </body>
</html>
EOF