From 9a4026fe965e926943d8c4ba74204dddc2190ea9 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Thu, 12 Apr 2007 17:31:49 +0200 Subject: [PATCH] debtags: Make HTML output more pretty Don't look up the description on the debtags vocabulary in the script but in the template. Split facet and tag in the script so that we can merge together multiple tags with the same facet. --- lib/Packages/DoShow.pm | 3 ++- templates/html/show.tmpl | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/Packages/DoShow.pm b/lib/Packages/DoShow.pm index 21bd985..0f76085 100644 --- a/lib/Packages/DoShow.pm +++ b/lib/Packages/DoShow.pm @@ -119,8 +119,9 @@ sub do_show { debug( "Data search and merging took ".timestr($std) ) if DEBUG; my $did = $page->get_newest( 'description' ); - my @tags = map { [ $_, $debtags{$_} ] } split(/, /, $page->get_newest( 'tag' )); + my @tags = map { [ split( /::/, $_) ] } split(/, /, $page->get_newest( 'tag' )); $contents{tags} = \@tags; + $contents{debtags_voc} = \%debtags; $section = $page->get_newest( 'section' ); $contents{section} = $section; diff --git a/templates/html/show.tmpl b/templates/html/show.tmpl index 43e5ca1..09befc4 100644 --- a/templates/html/show.tmpl +++ b/templates/html/show.tmpl @@ -146,11 +146,18 @@ Do not install it on a normal Debian system.

Tags: [%- END %] - [% IF tag.1 %] - [% tag.1 %][% ', ' UNLESS loop.last %] + [% facet = tag.0; + facet_name = debtags_voc.$facet; + tag_id = "$tag.0::$tag.1"; + tag_name = debtags_voc.$tag_id; + %] + [% facet_name _ ': ' UNLESS old_facet && facet == old_facet %] + [% IF tag_name %] + [% tag_name %][% ', ' UNLESS loop.last %] [% ELSE %] - [% tag.0 %][% ', ' UNLESS loop.last %] + [% tag_id %][% ', ' UNLESS loop.last %] [% END %] + [% old_facet = facet %] [% IF loop.last -%]

-- 2.39.2