shorne latest TODO parser, I _really_ will get this on the site soon, but I may get the wedding out of the way first ;)

SVN revision: 15559
This commit is contained in:
handyande 2005-06-28 12:48:48 +00:00 committed by handyande
parent 7cf61eb993
commit de368c38d1
1 changed files with 16 additions and 17 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
my $TODO; use strict;
my $new_item = 0; my $new_item = 0;
my $in_body = 0; my $in_body = 0;
@ -34,21 +34,22 @@ while(<>) {
} }
} elsif (/^\* /) { } elsif (/^\* /) {
if ($in_body ) { if ($in_body ) {
$_ =~ s/^\* //; if ($item->{'task'}) {
push(@{$todo_hash{$title}}, $item); my $task = $item->{'task'};
$item = {}; $task =~ s/^\* //;
$item->{'asignee'} = "Unknown"; if ($task =~ s/<(.*)>//) {
$item->{'task'} = $_ ; $item->{'asignee_email'} = $1;
if(/<(.*)>/) { $1 =~ /(.*) AT /;
my $email = $1;
if ($email =~ /(.*) AT /) {
$item->{'asignee'} = $1; $item->{'asignee'} = $1;
$item->{'asignee_email'} = $email;
} else { } else {
$item->{'asignee'} = $email;
$item->{'asignee_email'} = 0; $item->{'asignee_email'} = 0;
$item->{'asignee'} = 'None';
} }
$item->{'task'} = $task;
push(@{$todo_hash{$title}}, $item);
} }
$item = {};
$item->{'task'} = $_ ;
} }
} else { } else {
if ($in_body) { if ($in_body) {
@ -56,9 +57,6 @@ while(<>) {
$title = $_; $title = $_;
} else { } else {
$item->{'task'} = $item->{'task'} . $_ ; $item->{'task'} = $item->{'task'} . $_ ;
if(/<(.*)>/) {
$item->{'asignee'} = $1;
}
} }
} }
} }
@ -66,11 +64,11 @@ while(<>) {
} }
for $title ( keys %todo_hash ) { for $title ( keys %todo_hash ) {
my $count = 1;
print "<h2>" . $title . "</h2>\n"; print "<h2>" . $title . "</h2>\n";
print "<table>\n"; print "<table>\n";
print " <tr><td>Asignee</td><td>Task</td></tr>\n"; print " <tr><td>#</td><td>Asignee</td><td>Task</td></tr>\n";
for $item ( @{$todo_hash{$title}} ) { for $item ( @{$todo_hash{$title}} ) {
my $asignee_email = $item->{'asignee_email'}; my $asignee_email = $item->{'asignee_email'};
my $asignee = $item->{'asignee'}; my $asignee = $item->{'asignee'};
@ -83,7 +81,8 @@ for $title ( keys %todo_hash ) {
} else { } else {
$mailto = $asignee; $mailto = $asignee;
} }
print " <tr><td>$mailto</td><td>$task</td></tr>\n"; print " <tr><td>$count</td><td>$mailto</td><td>$task</td></tr>\n";
$count++;
} }
print "</table>\n"; print "</table>\n";
} }