|
| 1 | +#!/usr/bin/perl |
| 2 | + |
| 3 | +# Color coding |
| 4 | +# Note statuses will get lowercased before lookup |
| 5 | +%statusStyle = ( |
| 6 | + 'accepted' => 'a', |
| 7 | + 'retracted' => 'a', |
| 8 | + 'rejected' => 'r', |
| 9 | + 'objection' => 'fo', |
| 10 | + 'deferred' => 'd', |
| 11 | + 'invalid' => 'oi', |
| 12 | + 'outofscope' => 'oi', |
| 13 | +); |
| 14 | +# Header template is at the end of the file |
| 15 | + |
| 16 | +################################################################################ |
| 17 | + |
| 18 | +my $inFile = $ARGV[0]; |
| 19 | +if (!$inFile) { |
| 20 | + print "\nPass in issues list filename for processing!\n\n"; |
| 21 | + print "~~~~~~~~~~~~~~~~~~~~~ Template for issues-list.txt ~~~~~~~~~~~~~~~~~~~~~\n"; |
| 22 | + print <<XXX; |
| 23 | +
|
| 24 | +Draft: http://www.w3.org/TR/2013/WD-css-text-decor-3-20130103/ |
| 25 | +Title: CSS Text Decoration Level 3 |
| 26 | +... anything else you want here, except 4 dashes ... |
| 27 | +
|
| 28 | +---- |
| 29 | +Issue 1. |
| 30 | +Summary: [summary] |
| 31 | +From: [name] |
| 32 | +Comment: [url] |
| 33 | +Response: [url] |
| 34 | +Closed: [status ... or replace this "Closed" line with "Open"] |
| 35 | +Verified: [url] |
| 36 | +---- |
| 37 | +XXX |
| 38 | + exit; |
| 39 | +} |
| 40 | + |
| 41 | +# Input/Output setup |
| 42 | +my $outFile = $inFile; |
| 43 | +$outFile =~ s/\.txt/\.html/; |
| 44 | +open IN, "<", $inFile || die "Cannot open $inFile: $!"; |
| 45 | +open OUT, ">", $outFile || die "Cannot open $outFile: $!"; |
| 46 | +$/ = "----\n"; |
| 47 | + |
| 48 | +# Header |
| 49 | +&header; |
| 50 | + |
| 51 | +# Issues |
| 52 | +while (<IN>) { |
| 53 | + chomp; |
| 54 | + |
| 55 | + # Issue number |
| 56 | + s/Issue (\d+)\./Issue \1. <a href="#issue-\1">#<\/a>/; |
| 57 | + $index = $1; |
| 58 | + |
| 59 | + # Color coding |
| 60 | + $code = ''; |
| 61 | + if (/\nVerified:\s+http/) { |
| 62 | + $code = 'a'; |
| 63 | + } |
| 64 | + elsif (/\n(?:Closed|Open):\s+(\S+)/) { |
| 65 | + $code = $statusStyle{lc $1}; |
| 66 | + } |
| 67 | + if (/\nOpen/) { |
| 68 | + $code .= ' ' if $code; |
| 69 | + $code .= 'open'; |
| 70 | + } |
| 71 | + |
| 72 | + # And print it |
| 73 | + print OUT "<pre class='$code' id='issue-$index'>\n"; |
| 74 | + s/(http\S+)/<a href="\1">\1<\/a>/g; |
| 75 | + print OUT; |
| 76 | + print OUT "</pre>\n"; |
| 77 | +} |
| 78 | + |
| 79 | +sub header { |
| 80 | + # Read header |
| 81 | + local $_ = <IN>; |
| 82 | + chomp; |
| 83 | + |
| 84 | + # Extract title and URL |
| 85 | + my $title, $url; |
| 86 | + for (split /\n+/) { |
| 87 | + $title = $1 if (/^Title:\s+(.+)$/); |
| 88 | + $url = $1 if (/^Draft:\s+(\S+)/); |
| 89 | + } |
| 90 | + die "Error: missing document URL or title.\n" unless ($url && $title); |
| 91 | + |
| 92 | + # Process URL to get status, date, shorname |
| 93 | + die "Error: Draft URL wrong format.\n" unless |
| 94 | + ($url =~ /([A-Z]{2})-([a-z0-9-]+)-(\d{8})/); |
| 95 | + ($status, $shortname, $date) = ($1, $2, $3); |
| 96 | + $status = 'LCWD' if ('WD' eq $status && $inFile =~ /[lL][cC]/); |
| 97 | + $date = "$1-$2-$3" if ($date =~ /(\d{4})(\d{2})(\d{2})/); |
| 98 | + |
| 99 | + # Print it all out |
| 100 | + print OUT <<XXX; |
| 101 | +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
| 102 | +<title>$title Disposition of Comments for $date $status</title> |
| 103 | +<style type="text/css"> |
| 104 | + .a { background: lightgreen } |
| 105 | + .d { background: lightblue } |
| 106 | + .r { background: orange } |
| 107 | + .fo { background: red } |
| 108 | + .open { border: solid red; padding: 0.2em; } |
| 109 | + :target { box-shadow: 0.25em 0.25em 0.25em; } |
| 110 | +</style> |
| 111 | +
|
| 112 | +<h1>$title Disposition of Comments for $date $status</h1> |
| 113 | +
|
| 114 | +<p>Last call document: <a href="$url">$url</a> |
| 115 | +
|
| 116 | +<p>Editor's draft: <a href="http://dev.w3.org/csswg/$shortname/">http://dev.w3.org/csswg/$shortname/</a> |
| 117 | +
|
| 118 | +<p>The following color coding convention is used for comments:</p> |
| 119 | +
|
| 120 | +<ul> |
| 121 | + <li class="a">Accepted or Rejected and positive response |
| 122 | + <li class="r">Rejected and no response |
| 123 | + <li class="fo">Rejected and negative response |
| 124 | + <li class="d">Deferred |
| 125 | + <li class="oi">Out-of-Scope or Invalid and not verified |
| 126 | +</ul> |
| 127 | +
|
| 128 | +<p class=open>Open issues are marked like this</p> |
| 129 | +
|
| 130 | +<p>An issue can be closed as <code>Accepted</code>, <code>OutOfScope</code>, |
| 131 | +<code>Invalid</code>, <code>Rejected</code>, or <code>Retracted</code>. |
| 132 | +<code>Verified</code> indicates commentor's acceptance of the response.</p> |
| 133 | +XXX |
| 134 | +} |
0 commit comments