aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/man_show_fixme.sh
blob: 6a42b33210c9560bfab7f954c2e1becf4420d20f (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
#!/bin/sh
#
# Render man pages with FIXMEs shown as tables
# in the rendered page
#
for f in $*; do
    cat $f | awk '
        /^\.\\" *FIXME/ {
            if ($0 ~ /.*FIXME *\..*/) {
		# FIXMES of the form "FIXME ." are "private" and 
		# ignored by this script
            } else {
                sub("FIXME[: ]*", "")
		if ($0 ~ /^\.\\"[ 	]*$/) {

		    # If the FIXME line contains no additional text after
		    # "FIXME", then discard the blank line

		    getline
	        }
                print ""
                if (fixme == 0) {
                    print ".TS"
                    print ".allbox;"
                    print "lbw52"
                    print "l."
                    print "FIXME"
                    print "T{"
                }
                fixme = 1
            }
        }

        $0 !~ /^\.\\"/ && fixme == 1 {
            fixme = 0
            print "T}"
            print ".TE"
            print ""
        }

        fixme == 1 {
	    sub("^\\...[ ]", "")
	    sub("^\\...", "")
	    gsub("'"'"'", "\\(aq")
            if ($0 ~ /^[ 	][ 	]*.*/) {
                print ".br"
                sub("^[ 	]*", "    ")
            }
        }

        {
	    print $0
        }
    ' | tee "/tmp/$(basename $f).src" | man --nh --nj -l /dev/stdin
done