|
2 | 2 | # |
3 | 3 | # Takes a compact issues list in plain text and expands it to an HTML |
4 | 4 | # document. The issues list is line-based. Lines that start neither |
5 | | -# with "Issue" nor with a keyword and a colon are ignored. The lines |
6 | | -# are grouped into issues: each occurrence of "Issue:" starts a new |
7 | | -# issue. The following keywords are recognized: |
| 5 | +# with "Issue" nor with a keyword and a colon are ignored, unless they |
| 6 | +# are continuation lines (see below). The lines are grouped into issues: each |
| 7 | +# occurrence of "Issue:" starts a new issue. The following keywords |
| 8 | +# are recognized: |
8 | 9 | # |
9 | 10 | # Draft |
10 | 11 | # Must only occur once. The draft that these issues apply to. The |
|
24 | 25 | # issue. |
25 | 26 | # |
26 | 27 | # Comment |
27 | | -# A URL pointing to (a part of) the comment. May occur multiple |
28 | | -# times per issue. (Usually a pointer to a message on www-style.) |
| 28 | +# Typically a URL pointing to (a part of) the comment. May occur |
| 29 | +# multiple times per issue. (Usually a pointer to a message on |
| 30 | +# www-style.) |
29 | 31 | # |
30 | 32 | # Proposal |
31 | 33 | # A proposed answer for the WG to discuss. May occur multiple times |
32 | 34 | # per issue. This field is only printed if the issue is still open |
33 | 35 | # (i.e., has no "Closed" field.) |
34 | 36 | # |
35 | 37 | # Response |
36 | | -# A URL pointing to an answer that the WG sent to the commenter. |
37 | | -# (Usually a pointer to a message on www-style.) May occur multiple |
38 | | -# times per issue. Comment and Response lines should occur in date |
39 | | -# order: for each issue, older comments and responses should be |
40 | | -# listed before newer ones. |
| 38 | +# Typically a URL pointing to an answer that the WG sent to the |
| 39 | +# commenter. (Usually a pointer to a message on www-style.) May |
| 40 | +# occur multiple times per issue. Comment and Response lines should |
| 41 | +# occur in date order: for each issue, older comments and responses |
| 42 | +# should be listed before newer ones. |
41 | 43 | # |
42 | 44 | # Closed |
43 | 45 | # The WG's resolution. Can be "Accepted," "Rejected," "OutOfScope," |
|
53 | 55 | # resolution. Should only occur multiple times if there are |
54 | 56 | # multiple From lines. |
55 | 57 | # |
| 58 | +# "Summary:", "Comment:", "Response:", "From:" and "Proposal:" may |
| 59 | +# have continuation lines (in the case of Comment and Response only if |
| 60 | +# the first line contains text and not a URL), which are lines that |
| 61 | +# start with white space. |
| 62 | +# |
56 | 63 | # Author: Bert Bos <bert@w3.org> |
57 | 64 | # Created: 13 March 2012 |
58 | 65 | # Copyright: © 2012 World Wide Web Consortium |
59 | 66 | # See http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 |
60 | 67 |
|
61 | 68 |
|
62 | | -BEGIN {nerrors = 0; n = 0; IGNORECASE = 1} |
63 | | - |
64 | | -/^draft[ \t]*:/ {draft = val($0); next} |
65 | | -/^issue\>/ {h = val($0); if (h in id) err("Duplicate issue number: " h); id[++n] = h; next} |
66 | | -n && /^summary[ \t]*:/ {summary[n] = summary[n] "<p>" val($0); next} |
67 | | -n && /^comment[ \t]*:[ \t]*http:/ {link[n] = link[n] "<li><a href=\"" val($0) "\">comment</a>\n"; next} |
68 | | -n && /^comment[ \t]*:/ {link[n] = link[n] "<li>" val($0) "\n"; next} |
69 | | -n && /^response[ \t]*:[ \t]*http:/ {link[n] = link[n] "<li><a href=\"" val($0) "\">reply</a>\n"; next} |
70 | | -n && /^response[ \t]*:/ {link[n] = link[n] "<li>" val($0) "\n"; next} |
71 | | -n && /^from[ \t]*:/ {from[n] = (from[n] ? from[n] "<br>" : "") val($0); next} |
72 | | -n && /^proposal[ \t]*:/ {proposal[n] = proposal[n] "<p class=proposal>" val($0); next} |
73 | | -n && /^closed[ \t]*:[ \t]* accepted\>/ {status[n] = "accepted"; next} |
74 | | -n && /^closed[ \t]*:[ \t]* outofscope\>/ {status[n] = "outofscope"; next} |
75 | | -n && /^closed[ \t]*:[ \t]* invalid\>/ {status[n] = "invalid"; next} |
76 | | -n && /^closed[ \t]*:[ \t]* rejected\>/ {status[n] = "rejected"; next} |
77 | | -n && /^closed[ \t]*:[ \t]* retracted\>/ {status[n] = "retracted"; next} |
78 | | -n && /^closed[ \t]*:/ {err("Unrecognized resolution \"" val($0) "\"."); next} |
79 | | -n && /^verified[ \t]*:/ {verif[n] = verif[n] "<a href=\"" val($0) "\">verified</a> "; next} |
80 | | -n && /^objection[ \t]*:/ {obj[n] = obj[n] "<a href=\"" val($0) "\">objection</a> "; next} |
| 69 | +BEGIN {nerrors = 0; n = 0; prev = ""; IGNORECASE = 1} |
| 70 | + |
| 71 | +/* Lines that start with a field name: */ |
| 72 | + |
| 73 | +/^draft[ \t]*:/ { |
| 74 | + draft = val($0); |
| 75 | + prev = ""; |
| 76 | + next; |
| 77 | +} |
| 78 | +/^issue\>/ { |
| 79 | + h = val($0); |
| 80 | + if (h in id) err("Duplicate issue number: " h); |
| 81 | + id[++n] = h; |
| 82 | + prev = ""; |
| 83 | + next; |
| 84 | +} |
| 85 | +n && /^summary[ \t]*:/ { |
| 86 | + summary[n] = summary[n] "<p>" val($0); |
| 87 | + prev = "summary"; |
| 88 | + next; |
| 89 | +} |
| 90 | +n && /^comment[ \t]*:[ \t]*http:/ { |
| 91 | + link[n] = link[n] "<li><a href=\"" val($0) "\">comment</a>\n"; |
| 92 | + prev = ""; |
| 93 | + next; |
| 94 | +} |
| 95 | +n && /^comment[ \t]*:/ { |
| 96 | + link[n] = link[n] "<li>" val($0) "\n"; |
| 97 | + prev = "comment"; |
| 98 | + next; |
| 99 | +} |
| 100 | +n && /^response[ \t]*:[ \t]*http:/ { |
| 101 | + link[n] = link[n] "<li><a href=\"" val($0) "\">reply</a>\n"; |
| 102 | + prev = ""; |
| 103 | + next; |
| 104 | +} |
| 105 | +n && /^response[ \t]*:/ { |
| 106 | + link[n] = link[n] "<li>" val($0) "\n"; |
| 107 | + prev = "response"; |
| 108 | + next; |
| 109 | +} |
| 110 | +n && /^from[ \t]*:/ { |
| 111 | + from[n] = (from[n] ? from[n] "<br>" : "") val($0); |
| 112 | + prev = "from"; |
| 113 | + next; |
| 114 | +} |
| 115 | +n && /^proposal[ \t]*:/ { |
| 116 | + proposal[n] = proposal[n] "<p class=proposal>" val($0); |
| 117 | + prev = "proposal"; |
| 118 | + next; |
| 119 | +} |
| 120 | +n && /^closed[ \t]*:[ \t]* accepted\>/ { |
| 121 | + status[n] = "accepted"; |
| 122 | + prev = ""; |
| 123 | + next; |
| 124 | +} |
| 125 | +n && /^closed[ \t]*:[ \t]* outofscope\>/ { |
| 126 | + status[n] = "outofscope"; |
| 127 | + prev = ""; |
| 128 | + next; |
| 129 | +} |
| 130 | +n && /^closed[ \t]*:[ \t]* invalid\>/ { |
| 131 | + status[n] = "invalid"; |
| 132 | + prev = ""; |
| 133 | + next; |
| 134 | +} |
| 135 | +n && /^closed[ \t]*:[ \t]* rejected\>/ { |
| 136 | + status[n] = "rejected"; |
| 137 | + prev = ""; |
| 138 | + next; |
| 139 | +} |
| 140 | +n && /^closed[ \t]*:[ \t]* retracted\>/ { |
| 141 | + status[n] = "retracted"; |
| 142 | + prev = ""; |
| 143 | + next; |
| 144 | +} |
| 145 | +n && /^closed[ \t]*:/ { |
| 146 | + err("Unrecognized resolution \"" val($0) "\"."); |
| 147 | + prev = ""; |
| 148 | + next; |
| 149 | +} |
| 150 | +n && /^verified[ \t]*:/ { |
| 151 | + verif[n] = verif[n] "<a href=\"" val($0) "\">verified</a> "; |
| 152 | + prev = ""; |
| 153 | + next; |
| 154 | +} |
| 155 | +n && /^objection[ \t]*:/ { |
| 156 | + obj[n] = obj[n] "<a href=\"" val($0) "\">objection</a> "; |
| 157 | + prev = ""; |
| 158 | + next; |
| 159 | +} |
| 160 | + |
| 161 | +/* Continuation lines start with white space: */ |
| 162 | + |
| 163 | +/^[ \t]+[^ \t]/ && prev == "summary" { |
| 164 | + summary[n] = summary[n] val2($0); |
| 165 | + next; |
| 166 | +} |
| 167 | +/^[ \t]+[^ \t]/ && prev == "comment" { |
| 168 | + link[n] = link[n] val2($0); |
| 169 | + next; |
| 170 | +} |
| 171 | +/^[ \t]+[^ \t]/ && prev == "response" { |
| 172 | + link[n] = link[n] val2($0); |
| 173 | + next; |
| 174 | +} |
| 175 | +/^[ \t]+[^ \t]/ && prev == "from" { |
| 176 | + from[n] = from[n] val2($0); |
| 177 | + next; |
| 178 | +} |
| 179 | +/^[ \t]+[^ \t]/ && prev == "proposal" { |
| 180 | + proposal[n] = proposal[n] val2($0); |
| 181 | + next; |
| 182 | +} |
| 183 | + |
| 184 | +/* Any other line is ignored, any other field name is an error: */ |
| 185 | + |
| 186 | +{prev = ""} |
81 | 187 | n && /^[a-z]+[ \t]*:/ {err("Unrecognized keyword \"" $1 "\"."); next} |
82 | | -/^[a-z]+[ \t]*:/ {err("Incorrect keyword \"" $1 "\" before first issue.")} |
| 188 | +/^[a-z]+[ \t]*:/ {err("Incorrect keyword \"" $1 "\" before first issue."); next} |
83 | 189 |
|
84 | 190 | END {generate(); exit nerrors} |
85 | 191 |
|
@@ -202,8 +308,14 @@ function esc(s) |
202 | 308 | # val -- return the value part of the line s, as an HTML string |
203 | 309 | function val(s) |
204 | 310 | { |
205 | | - return \ |
206 | | - esc(gensub("[ \t]+$", "", 1, gensub("^[a-z]+[ \t]*(:[ \t]*)?", "", 1, s))) |
| 311 | + return esc(gensub("^[a-z]+[ \t]*(:[ \t]*)?", "", 1, s)); |
| 312 | +} |
| 313 | + |
| 314 | + |
| 315 | +# val2 -- return the line s with initial white space collapsed |
| 316 | +function val2(s) |
| 317 | +{ |
| 318 | + return esc(gensub("^[ \t]*", " ", 1, s)); |
207 | 319 | } |
208 | 320 |
|
209 | 321 |
|
|
0 commit comments