mkhtmlindex.sh revision bb2e14f3
1#!/bin/sh
2#
3# $XFree86: xc/config/util/mkhtmlindex.sh,v 1.3 2000/08/26 04:30:49 dawes Exp $
4#
5# Copyright © 2000 by Precision Insight, Inc.
6#
7# Generate index files for the HTML man pages
8#
9# Author:	David Dawes <dawes@xfree86.org>
10#
11
12VOLLIST="1 2 3 4 5 6 7 8 9 o l n p"
13INDEX="manindex"
14
15if [ $# != 1 ]; then
16	echo Usage: $0 htmlmandir
17	exit 1
18fi
19
20if [ ! -d $1 ]; then
21	echo $1 is not a directory
22	exit 1
23fi
24
25cd $1
26
27for s in $VOLLIST; do
28	list="`ls *.$s.html 2> /dev/null`" || : # ignore failed glob expansion
29	if [ X"$list" != X ]; then
30		file=$INDEX$s.html
31		rm -f $file
32		cat <<EOF > $file
33<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
34<HTML>
35<HEAD>
36<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
37<TITLE>X.Org Manual pages: Section $s</TITLE>
38</HEAD>
39<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
40
41<H1>X.Org Manual pages: Section $s</H1>
42<P>
43<UL>
44EOF
45		for i in $list; do
46			title="`sed -e '/^[^0-9A-Za-z]/d' -e '/^$/' -e '/^Name/d' -e q $i`"
47			name="`echo \"$title\" | sed -e 's/ - .*//'`"
48			desc="`echo \"$title\" | sed -e 's/[^-]* - //' -e 's/<P>//'`"
49			echo "<LI><A href=\"$i\">$name</A> - $desc</LI>" >> $file
50		done
51		cat <<EOF >> $file
52</UL>
53<P>
54</BODY>
55</HTML>
56EOF
57	fi
58done
59
60exit 0
61