Skip to content

Commit 8897f99

Browse files
committed
issuegen.pl sync with bikeshed
1 parent f384712 commit 8897f99

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

bin/issuegen.pl

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
s/</&lt;/g;
6363

6464
# Issue number
65-
s/Issue (\d+)\./Issue \1. <a href="#issue-\1">#<\/a>/;
65+
s/Issue (\d+)\./Issue \1. <a href='#issue-\1'>#<\/a>/;
6666
$index = $1;
6767

6868
# Color coding
@@ -80,11 +80,13 @@
8080

8181
# And print it
8282
print OUT "<pre class='$code' id='issue-$index'>\n";
83-
s/(http\S+)/<a href="\1">\1<\/a>/g;
83+
s/(http\S+)/<a href='\1'>\1<\/a>/g;
8484
print OUT;
8585
print OUT "</pre>\n";
8686
}
8787

88+
&script;
89+
8890
sub header {
8991
# Read header
9092
local $_ = <IN>;
@@ -107,7 +109,8 @@ sub header {
107109

108110
# Print it all out
109111
print OUT <<XXX;
110-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
112+
<!DOCTYPE html>
113+
<meta charset="utf-8">
111114
<title>$title Disposition of Comments for $date $status</title>
112115
<style type="text/css">
113116
.a { background: lightgreen }
@@ -141,3 +144,30 @@ sub header {
141144
<code>Verified</code> indicates commentor's acceptance of the response.</p>
142145
XXX
143146
}
147+
148+
sub script {
149+
print OUT <<XXX;
150+
<script>
151+
(function () {
152+
var sheet = document.styleSheets[0];
153+
function addCheckbox(className) {
154+
var element = document.querySelector('*.' + className);
155+
var span = document.createElement('span');
156+
span.innerHTML = element.innerHTML;
157+
element.innerHTML = null;
158+
var check = document.createElement('input');
159+
check.type = 'checkbox';
160+
check.checked = true;
161+
sheet.addRule('pre.' + className, '');
162+
var rule = sheet.rules[sheet.rules.length - 1];
163+
check.onchange = function (e) {
164+
rule.style.display = this.checked ? 'block' : 'none';
165+
}
166+
element.appendChild(check);
167+
element.appendChild(span);
168+
}
169+
['a', 'd', 'fo', 'oi', 'r', 'open'].forEach(addCheckbox);
170+
}());
171+
</script>
172+
XXX
173+
}

0 commit comments

Comments
 (0)