1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#!/usr/bin/perl -w
use strict;
#
# Not actually contributed by anybody, but people might find this useful.
#
# This is a small PERL script to convert a ChangeLog in the same format as that
# used by devtodo into a devtodo database.
#
# DISCLAIMER: I've only been using PERL for about a week, so I'm sure there are
# much easier ways of doing some of these things.
#
sub htmlify {
s/&/&/g;
s/</</g;
s/>/>/g;
return $_;
}
open(CHANGELOG, "ChangeLog");
print "<todo>\n";
my $version = "";
my $item = "";
my $pseudotime = 0;
while (<CHANGELOG>) {
if (/^[0-9]\.[0-9]\.[0-9]/) {
if ($item ne "") {
print $item;
print "</note>\n";
$item = "";
}
if ($version ne "") {
print "</note>\n";
$version = "";
}
print "<note priority='high' time='$pseudotime'>$_\n";
$pseudotime++;
$version = $_;
} elsif (/^\*/) {
s/^\*\w*//;
if ($item ne "") {
print $item;
print "</note>\n";
$item = "";
}
print "<note priority='medium' time='$pseudotime'>\n";
$pseudotime++;
chomp();
$item = htmlify($_);
} else {
chomp();
$item .= htmlify($_);
}
}
if ($item ne "") {
print $item;
print "</note>\n";
$item = "";
}
if ($version ne "") {
print "</note>\n";
$version = "";
}
print "</todo>\n";
close(CHANGELOG);
|