From 45f5194c8d72ec43d1094b9ca992d2fd00e2f298 Mon Sep 17 00:00:00 2001 From: schodet Date: Fri, 7 Oct 2005 23:18:42 +0000 Subject: Ajout du filtre sur les deadlines et les états. Ajout de la feuille de style. Mise à jour des templates. --- p/tools/todo.css | 41 ++++++++++++++++++++++++----------- p/tools/todo.html.tt | 60 ++++++++++++++++++++++++++++++---------------------- p/tools/todo.pl | 36 +++++++++++++++++++++++++++++-- p/tools/todo.text.tt | 17 +++++++-------- 4 files changed, 106 insertions(+), 48 deletions(-) (limited to 'p/tools') diff --git a/p/tools/todo.css b/p/tools/todo.css index ae1e494..1cd4241 100644 --- a/p/tools/todo.css +++ b/p/tools/todo.css @@ -1,21 +1,38 @@ -li { +ul { + margin: 1ex; border: 0; padding: 0; list-style-type: none } -li>ul>li.task { - border : 1px solid #000000; +p { + margin: 0; border: 0; padding: 0; +} +li { + margin: 1px; border: 0; padding: 1px; } -div>li>ul>li.task { - border : 0px; +li.section { + margin: 1px; border: 1px solid; padding: 1px; + margin-bottom: 1ex; + background: #88d; } - -div>li>p { - border : 1px solid #ff0000; +li.section > p { + border-bottom: 1px solid; } -div>li>ul>div>li>p { - border : 1px solid #00ff00; +span.owners { + text-align: right; } -div>li>ul>div>li>ul>div>li>p { - border : 1px solid #0000ff; +li.opened-task { + background: #d88; +} +li.closed-task { + background: #8d8; +} +li.running-task { + background: #b66; +} +li.canceled-task { + background: #bbb; +} +li.closed-task, li.canceled-task { + color: #666; } diff --git a/p/tools/todo.html.tt b/p/tools/todo.html.tt index 285c7e8..82951fc 100644 --- a/p/tools/todo.html.tt +++ b/p/tools/todo.html.tt @@ -8,37 +8,47 @@ -[% BLOCK leaf %] -
  • [% task.state %] [% task.text %] [% task.owner.join (', ') %]

  • +[% BLOCK state %] +[% +IF s == '-' ; + 'opened' ; +ELSIF s == '+' ; + 'closed' ; +ELSIF s == '=' ; + 'running' ; +ELSIF s == 'x' ; + 'canceled' ; +ELSE ; + 'unknown' ; +END %] [% END %] [% BLOCK task %] - [% IF tasks.size > 0 %] - [% FOREACH t = tasks %] - [% IF t.exists ('text') %] - [% PROCESS leaf task = t %] - [% ELSE %] - [% IF t.key %] - [% IF t.value.value.exists ('text') %] - prout - [% ELSE +%] -
  • [% t.key %]

    - -
  • - [%+ END %] - [% ELSE %] - [% PROCESS task tasks = t.value %] - [% END %] - [% END %] +$indent
  • [% +%]

    [% t.state +%] [%+ +%][% t.text %] +[% IF t.deadline ++%] [[% t.deadline %]][% END %] +[% IF t.owners.size ++%] ([% t.owners.join (', ') %])[% END %] +

  • +[%+ END %] + +[% BLOCK tasks %] + [% FOREACH t = tasks %] + [% IF t.key %] +$indent
  • [% t.key %]

  • +[%+ %] + [% ELSE %] + [% PROCESS task FOREACH t = t.value %] [% END %] - [% ELSE +%] -
  • Aucune Tache

  • - [%+ END %] + [% END %] [% END %] + diff --git a/p/tools/todo.pl b/p/tools/todo.pl index c0fed89..ceee0f5 100644 --- a/p/tools/todo.pl +++ b/p/tools/todo.pl @@ -97,6 +97,26 @@ sub parse_dir foreach @tododirs; } +# Drop empty nodes. +sub drop_empty +{ + my ($todos) = @_; + for (keys %$todos) + { + if ($_) + { + # Recurse. + drop_empty ($$todos{$_}); + # Drop if empty. + delete $$todos{$_} unless scalar keys %{$$todos{$_}}; + } + else + { + delete $$todos{$_} unless scalar @{$$todos{$_}}; + } + } +} + # Output todo tree file. sub output_tree { @@ -109,7 +129,6 @@ sub output_tree }); $tt->process ('todo.' . $$config{'format'} . '.tt', { 'tasks' => $t, - 'keep' => $$config{'keep-empty'}, 'owner' => !defined $$config{'owner'}, }) or die $tt->error; @@ -129,7 +148,9 @@ Options: -f, --format=FORMAT Set the output format ('text' or 'html', defaults to 'text'). -k, --keep-empty Keep empty sections. - -o, --owner=OWNER Output only task for OWNER + -o, --owner=OWNER Output only task for OWNER. + -O, --opened Output only opened tasks. + -s, --scheduled Output only scheduled task (i.e. with a deadline). -d, --dump Dump todo hash instead of normal output. -h, --help Print this help screen. EOF @@ -149,6 +170,8 @@ sub config 'format=s', 'keep-empty', 'owner=s', + 'open|O', + 'scheduled', 'dump|d', 'help', ) or die; @@ -165,9 +188,18 @@ my $filter = sub { { return 0 unless grep { $_ eq $config{'owner'} } @{$t{'owners'}}; } + if ($config{'open'}) + { + return 0 unless $t{'state'} =~ /[-=]/; + } + if ($config{'scheduled'}) + { + return 0 unless defined $t{'deadline'}; + } 1; }; parse_dir (\%todos, '', $config{'todo-dir'}, $filter); +drop_empty \%todos unless $config{'keep-empty'}; if (exists ($config{'dump'})) { use Data::Dumper; diff --git a/p/tools/todo.text.tt b/p/tools/todo.text.tt index 9982766..77207e0 100644 --- a/p/tools/todo.text.tt +++ b/p/tools/todo.text.tt @@ -1,20 +1,19 @@ [% BLOCK task %] -$indent${s.state} [%+ -"(${s.owners.join (', ')}) " IF s.owners.size && owner +$indent${t.state} [%+ +"[${t.deadline}] " IF t.deadline ; +"(${t.owners.join (', ')}) " IF t.owners.size && owner %] -${s.text} +${t.text} [%+ END %] [% BLOCK tasks %] [% FOREACH t = tasks %] - [% IF t.value.size || keep %] - [% IF t.key %] + [% IF t.key %] $indent${t.key} [%+ %] - [% INCLUDE tasks tasks = t.value indent = "$indent " %] - [% ELSE %] - [% PROCESS task FOREACH s = t.value %] - [% END %] + [% INCLUDE tasks tasks = t.value indent = "$indent " %] + [% ELSE %] + [% PROCESS task FOREACH t = t.value %] [% END %] [% END %] [% END %] -- cgit v1.2.3