|
Revision 290, 1.2 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 a devtodo database. |
|---|
| 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 |
return $_; |
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
open(CHANGELOG, "ChangeLog"); |
|---|
| 22 |
|
|---|
| 23 |
print "<todo>\n"; |
|---|
| 24 |
|
|---|
| 25 |
my $version = ""; |
|---|
| 26 |
my $item = ""; |
|---|
| 27 |
my $pseudotime = 0; |
|---|
| 28 |
|
|---|
| 29 |
while (<CHANGELOG>) { |
|---|
| 30 |
if (/^[0-9]\.[0-9]\.[0-9]/) { |
|---|
| 31 |
if ($item ne "") { |
|---|
| 32 |
print $item; |
|---|
| 33 |
print "</note>\n"; |
|---|
| 34 |
$item = ""; |
|---|
| 35 |
} |
|---|
| 36 |
if ($version ne "") { |
|---|
| 37 |
print "</note>\n"; |
|---|
| 38 |
$version = ""; |
|---|
| 39 |
} |
|---|
| 40 |
print "<note priority='high' time='$pseudotime'>$_\n"; |
|---|
| 41 |
$pseudotime++; |
|---|
| 42 |
$version = $_; |
|---|
| 43 |
} elsif (/^\*/) { |
|---|
| 44 |
s/^\*\w*//; |
|---|
| 45 |
if ($item ne "") { |
|---|
| 46 |
print $item; |
|---|
| 47 |
print "</note>\n"; |
|---|
| 48 |
$item = ""; |
|---|
| 49 |
} |
|---|
| 50 |
print "<note priority='medium' time='$pseudotime'>\n"; |
|---|
| 51 |
$pseudotime++; |
|---|
| 52 |
chomp(); |
|---|
| 53 |
$item = htmlify($_); |
|---|
| 54 |
} else { |
|---|
| 55 |
chomp(); |
|---|
| 56 |
$item .= htmlify($_); |
|---|
| 57 |
} |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
if ($item ne "") { |
|---|
| 61 |
print $item; |
|---|
| 62 |
print "</note>\n"; |
|---|
| 63 |
$item = ""; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
if ($version ne "") { |
|---|
| 67 |
print "</note>\n"; |
|---|
| 68 |
$version = ""; |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|
| 71 |
print "</todo>\n"; |
|---|
| 72 |
|
|---|
| 73 |
close(CHANGELOG); |
|---|