chiark / gitweb /
Build: Fix construction of manual pages.
[tripe] / common / make-summary
CommitLineData
13a55605
MW
1#! /usr/bin/awk -f
2
3BEGIN { n = 0; opts = 0; sep = 0; }
4
5/^\.\\\"\* ([0-9]+) (.*)$/ {
6 n = $2;
7 name = $3;
8 for (i = 4; i <= NF; i++) name = name " " $i;
9 head[n] = name;
10}
11/^\.\\\"\+opts$/ { opts = 1; lines[n] = lines[n] "\\h'2n'Options:\n.RS\n"; }
12/^\.\\\"\-opts$/ { opts = 0; lines[n] = lines[n] ".RE\n"; }
13/^\.\\\"\+sep$/ { sep = 1; }
14/^\.\\\"\-sep$/ { sep = 0; }
15/^\.\\\"\-opts$/ { opts = 0; lines[n] = lines[n] ".RE\n"; }
fc916a09 16/^\.SP/ { print ".TP"; getline; lines[n] = lines[n] $0 "\n"; }
13a55605
MW
17/^\.TP/ { if (opts) { print; getline; lines[n] = lines[n] $0 "\n"; } }
18/^\.SS/ { if (sep) lines[n] = lines[n] ".PP\n"; }
19
20{ print; }
21
22/^\.\\\"= summary/ {
23 for (i = 0; i < 100; i++) {
24 if (!(i in head)) continue;
25 print ".SS \"" head[i] "\"";
26 print ".nf";
27 print lines[i] ".fi";
28 }
29}