File: man2html

package info (click to toggle)
postfix 2.3.8-2%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 15,744 kB
  • ctags: 11,426
  • sloc: ansic: 81,810; makefile: 10,743; sh: 7,874; perl: 2,468; awk: 41
file content (36 lines) | stat: -rwxr-xr-x 805 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

# Crude script to convert formatted manual pages to HTML

while :
do
    case $1 in
    -t) title=$2; shift; shift;;
    -*) echo "Usage: $0 [-t title] [file(s)]" 1>&2; exit 1;;
     *) break;;
    esac
done

echo "<!doctype html public \"-//W3C//DTD HTML 4.01 Transitional//EN\"
        \"http://www.w3.org/TR/html4/loose.dtd\">
<html> <head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\">
<title> $title </title>
</head> <body> <pre>"

sed '
	s/\([<>&]\)\1/\1/g
	s/&/\&amp;/g
	s/_</\&lt;/g
	s/<</\&lt;/g
	s/</\&lt;/g
	s/_>/\&gt;/g
	s/>>/\&gt;/g
	s/>/\&gt;/g
	s;_\([^_]\);<i>\1</i>;g
	s;.\(.\);<b>\1</b>;g
	s;</i>\( *\)<i>;\1;g
	s;</b>\( *\)<b>;\1;g
' "$@" | egrep -v 'postconf (readme|html)_direc|tory</b>" *to *locate *this'

echo '</pre> </body> </html>'