===================================================================
RCS file: /cvs/todotxt/Text-Todo/bin/dudelicious.pl,v
retrieving revision 1.12
retrieving revision 1.16
diff -u -r1.12 -r1.16
--- todotxt/Text-Todo/bin/dudelicious.pl 2010/05/01 21:54:56 1.12
+++ todotxt/Text-Todo/bin/dudelicious.pl 2010/05/05 03:01:08 1.16
@@ -82,6 +82,7 @@
else {
$self->render(
list => $self->helper('get_list'),
+ tags => $self->helper('todo')->known_tags,
layout => 'todotxt'
);
}
@@ -105,16 +106,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,20 +146,33 @@
<%= $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