Hi, I have fixed a bug (it was only looking for the asignee on the first line) and cleaned up the code in the todo parser. here is a patch and the source file.
Also I have added todo list Item numbering. I have attached the entire file because it will probably be easier to just replace that then to apply the patch. Stafford --
Index: parse_todo.pl
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/data/other/parse_todo.pl,v
retrieving revision 1.4
diff -u -r1.4 parse_todo.pl
--- parse_todo.pl 27 Jun 2005 15:52:58 -0000 1.4
+++ parse_todo.pl 28 Jun 2005 12:14:40 -0000
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-my $TODO;
+use strict;
my $new_item = 0;
my $in_body = 0;
@@ -34,21 +34,22 @@
}
} elsif (/^\* /) {
if ($in_body ) {
- $_ =~ s/^\* //;
- push(@{$todo_hash{$title}}, $item);
- $item = {};
- $item->{'asignee'} = "Unknown";
- $item->{'task'} = $_ ;
- if(/<(.*)>/) {
- my $email = $1;
- if ($email =~ /(.*) AT /) {
+ if ($item->{'task'}) {
+ my $task = $item->{'task'};
+ $task =~ s/^\* //;
+ if ($task =~ s/<(.*)>//) {
+ $item->{'asignee_email'} = $1;
+ $1 =~ /(.*) AT /;
$item->{'asignee'} = $1;
- $item->{'asignee_email'} = $email;
} else {
- $item->{'asignee'} = $email;
$item->{'asignee_email'} = 0;
+ $item->{'asignee'} = 'None';
}
+ $item->{'task'} = $task;
+ push(@{$todo_hash{$title}}, $item);
}
+ $item = {};
+ $item->{'task'} = $_ ;
}
} else {
if ($in_body) {
@@ -56,9 +57,6 @@
$title = $_;
} else {
$item->{'task'} = $item->{'task'} . $_ ;
- if(/<(.*)>/) {
- $item->{'asignee'} = $1;
- }
}
}
}
@@ -66,11 +64,11 @@
}
for $title ( keys %todo_hash ) {
-
+ my $count = 1;
print "<h2>" . $title . "</h2>\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}} ) {
my $asignee_email = $item->{'asignee_email'};
my $asignee = $item->{'asignee'};
@@ -83,7 +81,8 @@
} else {
$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";
}
parse_todo.pl
Description: Perl program
