aboutsummaryrefslogtreecommitdiff
path: root/dist/manweb
blob: 32e902988371fac5cafb41289299580b44f81da5 (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
#!/usr/local/plan9/bin/rc

verbose=no
if(~ $1 -v)
	verbose=yes

fn silencer {
	switch($verbose){
	case no
		cat >/dev/null
	case yes
		cat
	}
}

. 9.rc
cd $PLAN9/man
# rm -f */*.html

for(i in */INDEX) @{
	n=`{echo $i | sed 's/man//;s!/INDEX!!'}
	cat $PLAN9/dist/manindextop.html | sed 's/NNN/'$n'/g'
	cd `{basename -d $i}
	# complicated sort order: want 9p.3, 9p-cmdbuf.3, 9pclient.3
	for (j in `{ls [a-z0-9:]*.[0-9]* >[2]/dev/null | sed 's/[.\-]/ &/g;s/\./ &/g' | sort | tr -d ' '}){
		n=`{grep '^\.TH' $j | sed 1q | awk '{print $3}'}
		name=`{echo $j | sed 's/\..*//'}
		if(~ $name 0intro)
			name=intro
		if not{
			echo '<tr height=1><td>'
			echo '<tr height=1><td colspan=2 bgcolor=#cccccc>'
			echo '<tr height=1><td>'
		}
		echo -n '<tr><td valign=top><a href="'$name'.html">'$name'('$n')</a><td>'
		sed -n '
		/SH *NAM/,/SH/{
			/SH/d
			s/, *$//
			ty
			:y
			s/ *\\*-.*/&/
			tx
			s/ *\\\(mi.*/&/
			tx
			s/\n\\n/\
/g
			p
		}
		/SH *DES/q
		d
		:x
		/^$/d
		s/\n\n/\
/g
		s/\\-/\&ndash;/
		p
		q' $j
	}
	cat $PLAN9/dist/manindexbottom.html
} >$i.html && mv $i.html `{echo $i.html | tr A-Z a-z}

for (i in */[~.]*.[0-9]*){
	j=`{echo $i | 9 sed 's/\..*//'}
	p=`{basename $j}
	d=`{basename -d $j}
	if(~ $p 0intro)
		p=intro
	if(~ $verbose yes) echo $d/$p
	troff -manhtml $i | troff2html -t 'Plan 9 from User Space'>/tmp/manweb.html |[2] silencer
	{
		sed '/<!-- TRAILER -->/q' /tmp/manweb.html
		cat $PLAN9/dist/mantrailer.html
		sed -n '/<!-- TRAILER -->/,$p' /tmp/manweb.html
	} | $PLAN9/dist/addsrclinks >$d/$p.html
}
rm /tmp/manweb.html
cd $PLAN9/dist
./fixurls $PLAN9/man/man*/*.html