man2html revision 1.1.1.5 1 #!/bin/sh
2
3 # Crude script to convert formatted manpages to HTML. Requires GROFF_NO_SGR.
4
5 while :
6 do
7 case $1 in
8 -t) title=$2; shift; shift;;
9 -*) echo "Usage: $0 [-t title] [file(s)]" 1>&2; exit 1;;
10 *) break;;
11 esac
12 done
13
14 echo "<!doctype html public \"-//W3C//DTD HTML 4.01 Transitional//EN\"
15 \"http://www.w3.org/TR/html4/loose.dtd\">
16 <html> <head>
17 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
18 <link rel='stylesheet' type='text/css' href='postfix-doc.css'>
19 <title> $title </title>
20 </head> <body> <pre>"
21
22 #ESC=`echo x | tr '[x]' '[\033]'`
23
24 sed '
25 s/\([<>&]\)\1/\1/g
26 s/&/\&/g
27 s/_</\</g
28 s/<</\</g
29 s/</\</g
30 s/_>/\>/g
31 s/>>/\>/g
32 s/>/\>/g
33 s;_\([^_]\);<i>\1</i>;g
34 s;.\(.\);<b>\1</b>;g
35
36 s;</i>\( *\)<i>;\1;g
37 s;</b>\( *\)<b>;\1;g
38
39 # Skip the redundant readme/html_directory blurb. The
40 # document names that follow will be hyperlinked.
41 /^<b>README FILES/{
42 h
43 N
44 N
45 g
46 }
47 ' "$@"
48
49 echo '</pre> </body> </html>'
50