Skip to content

Commit a119fb8

Browse files
committed
Two-color DoC generator, per ChrisL's request.
1 parent 4baa3e0 commit a119fb8

1 file changed

Lines changed: 35 additions & 20 deletions

File tree

bin/issuegen.pl

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,42 @@
140140
# Issues
141141
while (<IN>) {
142142
chomp;
143+
143144
# Don't pipe code
144145
s/</&lt;/g;
145146

146-
# Issue number
147+
# Linkify URLs
148+
s/(http\S+)/<a href='\1'>\1<\/a>/g;
149+
150+
# Anchor issue number
147151
s/Issue (\d+)\./Issue \1. <a href='#issue-\1'>#<\/a>/;
148152
$index = $1;
149153

150-
# Color coding
151-
$code = '';
152-
if (/\nVerified:\s+\S+/) {
153-
$code = 'a';
154-
}
155-
elsif (/\n(?:Closed|Open):\s+(\S+)/) {
156-
$code = $statusStyle{lc $1};
157-
}
158-
if (/\nOpen/) {
159-
$code .= ' ' if $code;
160-
$code .= 'open';
154+
# Color coding WG response
155+
@lines = split /\n/;
156+
foreach (@lines) {
157+
# Get Status
158+
if (/^Open/) {
159+
$status = 'open';
160+
}
161+
# Colorize WG response
162+
if (/^(?:Closed|Open):\s+(\S+)$/) {
163+
$code = $statusStyle{lc $1};
164+
$_ = '<span class="' . $code . '">' . $_ . '</span>';
165+
}
166+
# Colorize commenter response
167+
elsif (/^Verified:\s+\S+$/) {
168+
$code = 'a';
169+
$_ = '<span class="a">' . $_ . '</span>';
170+
}
171+
else {
172+
$_ = '<span>' . $_ . '</span>';
173+
}
161174
}
162175

163176
# And print it
164-
print OUT "<pre class='$code' id='issue-$index'>\n";
165-
s/(http\S+)/<a href='\1'>\1<\/a>/g;
166-
print OUT;
177+
print OUT "<pre class='$status $code' id='issue-$index'>\n";
178+
print OUT join "\n", @lines;
167179
print OUT "</pre>\n";
168180
}
169181

@@ -195,11 +207,14 @@ sub header {
195207
<meta charset="utf-8">
196208
<title>$title Disposition of Comments for $date $status</title>
197209
<style type="text/css">
198-
.a { background: lightgreen }
199-
.d { background: lightblue }
200-
.r { background: orange }
201-
.fo { background: red }
202-
.open { border: solid red; padding: 0.2em; }
210+
pre { border: solid thin silver; padding: 0.2em; white-space: normal; }
211+
pre > span { display: block; white-space: pre; }
212+
:not(pre).a { background: lightgreen }
213+
:not(pre).d { background: lightblue }
214+
:not(pre).oi { background: yellow }
215+
:not(pre).r { background: orange }
216+
:not(pre).fo { background: red }
217+
.open { border: solid red; }
203218
:target { box-shadow: 0.25em 0.25em 0.25em; }
204219
</style>
205220

0 commit comments

Comments
 (0)