summaryrefslogtreecommitdiffstats
path: root/mantools/html2readme
blob: b7d110c5fd71c0eb89fde258feb7e7662487ef02 (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
#!/bin/sh

HTML2TEXT="html2text -ascii -style pretty -rcfile html2text.rc"

#case $# in
# 0) $HTML2TEXT;;
# *) for file 
#    do
#        cat <<EOF | fmt
#[hyperlinked version: www.postfix.org/$file]
#EOF
#         $HTML2TEXT $file
#    done;;
#esac | sed '

$HTML2TEXT "$@" | sed '
:top
/ -$/ {
	N
	s/ -\n  o/ -o/
	b top
}
/^  \*$/ {
	N
	s/\*\n    /* /
	b top
}
' | awk '
/^$/ && prev_len == 0 { next }
		      { print; prev_len = length }
'