X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/452bf3f6897b8c6a22b51e1ef228da39136d51a7..13a55605839046f6f42910de713f4a9b6c44dfd4:/doc/make-summary?ds=sidebyside diff --git a/doc/make-summary b/doc/make-summary new file mode 100755 index 00000000..2aff34c6 --- /dev/null +++ b/doc/make-summary @@ -0,0 +1,29 @@ +#! /usr/bin/awk -f + +BEGIN { n = 0; opts = 0; sep = 0; } + +/^\.\\\"\* ([0-9]+) (.*)$/ { + n = $2; + name = $3; + for (i = 4; i <= NF; i++) name = name " " $i; + head[n] = name; +} +/^\.\\\"\+opts$/ { opts = 1; lines[n] = lines[n] "\\h'2n'Options:\n.RS\n"; } +/^\.\\\"\-opts$/ { opts = 0; lines[n] = lines[n] ".RE\n"; } +/^\.\\\"\+sep$/ { sep = 1; } +/^\.\\\"\-sep$/ { sep = 0; } +/^\.\\\"\-opts$/ { opts = 0; lines[n] = lines[n] ".RE\n"; } +/^\.SP/ { print; getline; lines[n] = lines[n] $0 "\n"; } +/^\.TP/ { if (opts) { print; getline; lines[n] = lines[n] $0 "\n"; } } +/^\.SS/ { if (sep) lines[n] = lines[n] ".PP\n"; } + +{ print; } + +/^\.\\\"= summary/ { + for (i = 0; i < 100; i++) { + if (!(i in head)) continue; + print ".SS \"" head[i] "\""; + print ".nf"; + print lines[i] ".fi"; + } +}