===================================================================
RCS file: /cvs/todotxt/Text-Todo/bin/dudelicious.pl,v
retrieving revision 1.12
retrieving revision 1.15
diff -u -r1.12 -r1.15
--- todotxt/Text-Todo/bin/dudelicious.pl 2010/05/01 21:54:56 1.12
+++ todotxt/Text-Todo/bin/dudelicious.pl 2010/05/05 02:43:03 1.15
@@ -105,16 +105,32 @@
my $self = shift;
my $format = $self->stash('format') || 'html';
- my $tags = $self->helper('todo')->known_tags;
if ( $format eq 'json' ) {
- $self->render_json($tags);
+ $self->render_json( $self->helper('todo')->known_tags );
}
else {
- $self->render( tags => $tags, layout => 'todotxt' );
+ $self->render(
+ tags => $self->helper('todo')->known_tags,
+ layout => 'todotxt'
+ );
}
} => 'tags';
+get '/l/:file/t/:tag' => sub {
+ my $self = shift;
+
+ my $format = $self->stash('format') || 'html';
+ my $items = $self->helper('todo')->listtag( $self->stash('tag') );
+
+ if ( $format eq 'json' ) {
+ $self->render_json($items);
+ }
+ else {
+ $self->render( items => $items, layout => 'todotxt' );
+ }
+} => 'tag';
+
app->start if !caller();
1;
@@ -129,16 +145,23 @@
<%= $entry->{text} %>
@@ tags.txt.ep
-% foreach my $tag (keys%{ $tags }) {
-<%= $tag %>, <%= $tags->{$tag} %>
+% foreach my $tag (keys %{ $tags }) {
+<%= $tag %>: <%= $tags->{$tag} %>
% }
+@@ tag.txt.ep
+# <%== $tag %>
+% foreach my $item (@{ $items}) {
+<%= $item %>
+% }
+
@@ layouts/todotxt.txt.ep
%= content
@@ index.html.ep
% foreach my $file (@{ $files }) {
-<%== $file %>
+% my ($basename) = $file =~ /^(.*?)(?:\.[^\.]+)?$/xms;
+<%= $file %>
% }
@@ list.html.ep
@@ -156,9 +179,14 @@
@@ tags.html.ep
% foreach my $tag (keys%{ $tags }) {
-<%= $tag %> == <%= $tags->{$tag} %>
+<%= $tag %> == <%= $tags->{$tag} %>
% }
+@@ tag.html.ep
+