diff options
author | rillig <rillig@pkgsrc.org> | 2008-01-05 17:01:23 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2008-01-05 17:01:23 +0000 |
commit | 4d3b9ab24d9cf3812b9693a95c7adea57841041e (patch) | |
tree | da40ac01009abca3bd5ec55bd05a0f74b652b3d3 /mk | |
parent | 9ebf10c62ee9b01d29b2b5e0cd2a8164b1ce3f8e (diff) | |
download | pkgsrc-4d3b9ab24d9cf3812b9693a95c7adea57841041e.tar.gz |
Instead of just recording whether a topic is relevant or not, collect
all applicable keywords (like variable names, make targets or explicit
keywords). This will help printing an index of all keywords.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/help/help.awk | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/mk/help/help.awk b/mk/help/help.awk index 25f1ac12d48..ba20c582206 100644 --- a/mk/help/help.awk +++ b/mk/help/help.awk @@ -1,4 +1,4 @@ -# $NetBSD: help.awk,v 1.18 2007/12/13 11:48:38 rillig Exp $ +# $NetBSD: help.awk,v 1.19 2008/01/05 17:01:23 rillig Exp $ # # This program extracts the inline documentation from *.mk files. @@ -20,8 +20,8 @@ BEGIN { ignore_next_empty_line = no; delete lines; # the collected lines - relevant = no; # are the current lines relevant? nlines = 0; # the number of lines collected so far + delete keywords; # the keywords for this paragraph comment_lines = 0; # the number of comment lines so far print_noncomment_lines = yes; # for make targets, this isn't useful } @@ -30,12 +30,17 @@ BEGIN { # end of a file or by the end of all files. When there have been enough # comment lines, the topic is considered worth printing. # -function end_of_topic() { +function end_of_topic( kw, relevant) { + kw = ""; + for (i in keywords) { + kw = kw " " i; + } + relevant = (topic in keywords || lctopic in keywords || uctopic in keywords); if (relevant && comment_lines > 2) { if (found_anything) print ""; found_anything = yes; - print "===> "last_fname":"; + print "===> "last_fname " (keywords:" kw "):"; for (i = 0; i < nlines; i++) { if (print_noncomment_lines || (lines[i] ~ /^#/)) print lines[i]; @@ -44,8 +49,8 @@ function end_of_topic() { ignore_next_empty_line = yes; delete lines; - relevant = no; nlines = 0; + delete keywords; comment_lines = 0; print_noncomment_lines = yes; } @@ -70,9 +75,8 @@ always { ($1 == "#" && $2 == "Keywords:") { for (i = 3; i <= NF; i++) { w = ($i == toupper($i)) ? tolower($i) : $i; - if (w == lctopic || w == lctopic",") { - relevant = yes; - } + sub(/,$/, "", w); + keywords[w] = yes; } ignore_this_line = yes; ignore_next_empty_line = yes; @@ -116,7 +120,7 @@ NF >= 1 { (index(w1, "#"uctopic"?=") == 1) || (this_line_maybe_definition && (w == uctopic || w == uctopic":"))) { - relevant = yes; + keywords[w] = yes; } } |