|
Revision 290, 1.7 kB
(checked in by athomas, 4 years ago)
|
Initial import.
|
- Property svn:executable set to
|
| Line | |
|---|
| 1 |
#!/usr/bin/perl -w |
|---|
| 2 |
use strict; |
|---|
| 3 |
|
|---|
| 4 |
# |
|---|
| 5 |
# Not actually contributed by anybody, but people might find this useful. |
|---|
| 6 |
# |
|---|
| 7 |
# This is a small PERL script to convert a ChangeLog in the same format as that |
|---|
| 8 |
# used by devtodo into HTML. |
|---|
| 9 |
# |
|---|
| 10 |
# DISCLAIMER: I've only been using PERL for about a week, so I'm sure there are |
|---|
| 11 |
# much easier ways of doing some of these things. |
|---|
| 12 |
# |
|---|
| 13 |
|
|---|
| 14 |
sub htmlify { |
|---|
| 15 |
s/&/&/g; |
|---|
| 16 |
s/</</g; |
|---|
| 17 |
s/>/>/g; |
|---|
| 18 |
s/\n/<br>\n/g; |
|---|
| 19 |
s/ / /g; |
|---|
| 20 |
return $_; |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
open(CHANGELOG, "ChangeLog"); |
|---|
| 24 |
|
|---|
| 25 |
my $version = ""; |
|---|
| 26 |
my $item = ""; |
|---|
| 27 |
my $pseudotime = 0; |
|---|
| 28 |
|
|---|
| 29 |
my $intensity = 0; |
|---|
| 30 |
my $textcolour = sprintf("%02x%02x%02x", $intensity * 255, $intensity * 255, $intensity * 255); |
|---|
| 31 |
my $titlecolour = sprintf("%02x%02x%02x", $intensity * 255, $intensity * 255, $intensity * 255); |
|---|
| 32 |
|
|---|
| 33 |
while (<CHANGELOG>) { |
|---|
| 34 |
if (/^[0-9]\.[0-9]\.[0-9]/) { |
|---|
| 35 |
if ($item ne "") { |
|---|
| 36 |
print "<font color=#$textcolour>$item</font>"; |
|---|
| 37 |
print "</li>\n"; |
|---|
| 38 |
$item = ""; |
|---|
| 39 |
} |
|---|
| 40 |
if ($version ne "") { |
|---|
| 41 |
print "</ul>\n"; |
|---|
| 42 |
$version = ""; |
|---|
| 43 |
} |
|---|
| 44 |
$textcolour = sprintf("%02x%02x%02x", $intensity * 255, $intensity * 255, $intensity * 255); |
|---|
| 45 |
$titlecolour = sprintf("%02x%02x%02x", $intensity * 255, $intensity * 255, $intensity * 255); |
|---|
| 46 |
$intensity += 0.1; |
|---|
| 47 |
if ($intensity > 1.0) { goto quit; } |
|---|
| 48 |
print "<ul><h3><font color=#$titlecolour>Version $_</font></h3>\n"; |
|---|
| 49 |
$pseudotime++; |
|---|
| 50 |
$version = $_; |
|---|
| 51 |
} elsif (/^\*/) { |
|---|
| 52 |
s/^\*\w*//; |
|---|
| 53 |
if ($item ne "") { |
|---|
| 54 |
print "<font color=#$textcolour>$item</font>"; |
|---|
| 55 |
print "</li>\n"; |
|---|
| 56 |
$item = ""; |
|---|
| 57 |
} |
|---|
| 58 |
print "<li color=#$textcolour>\n"; |
|---|
| 59 |
$pseudotime++; |
|---|
| 60 |
$item = htmlify($_); |
|---|
| 61 |
} else { |
|---|
| 62 |
$item .= htmlify($_); |
|---|
| 63 |
} |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
quit: |
|---|
| 67 |
|
|---|
| 68 |
if ($item ne "") { |
|---|
| 69 |
print $item; |
|---|
| 70 |
print "</li>\n"; |
|---|
| 71 |
$item = ""; |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
if ($version ne "") { |
|---|
| 75 |
print "</ul>\n"; |
|---|
| 76 |
$version = ""; |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|
| 79 |
close(CHANGELOG); |
|---|