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