Hi, 

The parser was always placing the last todo task in a section in the
wrong category. 

How can I have written this program with so many bugs? No thought...
just code blindy until something works. Well isn't that how perl
programming goes?

anyway, here is a patch. don't be suprised if there are more

Still, its a fun little project

Stafford
-- 
Index: data/other/parse_todo.pl
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/data/other/parse_todo.pl,v
retrieving revision 1.5
diff -u -r1.5 parse_todo.pl
--- data/other/parse_todo.pl	28 Jun 2005 12:48:48 -0000	1.5
+++ data/other/parse_todo.pl	29 Jun 2005 12:44:12 -0000
@@ -17,13 +17,36 @@
 my $title;
 my $item = {};
 
+# use globals
+sub push_item {
+    	if ($item->{'task'}) {
+		my $task = $item->{'task'};
+		$task =~ s/^\* //;
+		if ($task =~ s/<(.*)>//) {
+			$item->{'asignee_email'} = $1;
+			$1 =~ /(.*) AT /;
+			$item->{'asignee'} = $1;
+		} else {
+			$item->{'asignee_email'} = 0;
+			$item->{'asignee'} = 'None';
+		}
+		$item->{'task'} = $task;
+		push(@{$todo_hash{$title}}, $item);
+	}
+}
+
 while(<>) {
 	chomp;    
 
 	if(/\[\[\[/) {
+		$item->{'task'} = 0;
 		$in_body = 1;
 	} elsif (/\]\]\]/) {
-		$in_body = 0;
+		if ($in_body) {
+			push_item;
+			$item = {};
+			$in_body = 0;
+		}
 	} elsif (/^---.*---$/) {
 		if ($in_body) {
 			if($is_title) {
@@ -34,20 +57,7 @@
 		}
 	} elsif (/^\* /) {
 		if ($in_body ) {
-			if ($item->{'task'}) {
-				my $task = $item->{'task'};
-				$task =~ s/^\* //;
-				if ($task =~ s/<(.*)>//) {
-					$item->{'asignee_email'} = $1;
-					$1 =~ /(.*) AT /;
-					$item->{'asignee'} = $1;
-				} else {
-					$item->{'asignee_email'} = 0;
-					$item->{'asignee'} = 'None';
-				}
-				$item->{'task'} = $task;
-				push(@{$todo_hash{$title}}, $item);
-			}
+			push_item;
 			$item = {};
 			$item->{'task'} = $_ ;
 		}
@@ -77,7 +87,7 @@
 		my $mailto;
 
 		if ($asignee_email) {
-		     $mailto = "<a href='mailto:$asignee_email'>$asignee</a>"	
+		     $mailto = "<a href='mailto://$asignee_email'>$asignee</a>"	
 		} else {
 		     $mailto = $asignee;
 		}

Reply via email to