r20269 - in /scripts/qa: pkginfo.cgi templates/pkginfo

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Thu May 22 10:11:12 UTC 2008


Author: dmn
Date: Thu May 22 10:11:12 2008
New Revision: 20269

URL: http://svn.debian.org/wsvn/?sc=1&rev=20269
Log:
first attempt at beautifying pkginfo

Added:
    scripts/qa/templates/pkginfo
Modified:
    scripts/qa/pkginfo.cgi

Modified: scripts/qa/pkginfo.cgi
URL: http://svn.debian.org/wsvn/scripts/qa/pkginfo.cgi?rev=20269&op=diff
==============================================================================
--- scripts/qa/pkginfo.cgi (original)
+++ scripts/qa/pkginfo.cgi Thu May 22 10:11:12 2008
@@ -5,6 +5,7 @@
 # Dump all info about a package
 #
 # Copyright Martín Ferrari <martin.ferrari at gmail.com>, 2008
+# © 2008 Damyan Ivanov <dmn at debian.org>
 # Released under the terms of the GNU GPL 2
 use strict;
 use warnings;
@@ -69,17 +70,41 @@
     setlocale(LC_TIME, $old_locale);
 }
 
-use Data::Dumper;
-foreach(qw(svn watch archive bts)) {
-    my $text = "$_\n", "-"x78, "\n";
-    $text .= Dumper($cache->{$_}{$pkg}) . "\n";
-    $text =~ s/&/&amp;/g;
-    $text =~ s/'/&apos;/g;
-    $text =~ s/"/&quot;/g;
-    $text =~ s/</&lt;/g;
-    $text =~ s/>/&gt;/g;
-    $text =~ s{\r?\n}{<br/>}g;
-    print qq(<code style="white-space: pre">$text</code>);
-}
+
+use Template;
+my $tt = new Template(
+    {
+        INCLUDE_PATH => $CFG{qareport_cgi}{templates_path},
+        INTERPOLATE  => 1,
+        POST_CHOMP   => 1,
+        FILTERS      => {
+            'quotemeta' => sub { quotemeta(shift) },
+        },
+    }
+);
+
+$tt->process(
+    'pkginfo',
+    {
+        sections    => [
+            {
+                title   => 'SVN',
+                data    => $cache->{svn}{$pkg},
+            },
+            {
+                title   => 'Upstream',
+                data    => $cache->{watch}{$pkg},
+            },
+            {
+                title   => 'Archive',
+                data    => $cache->{archive}{$pkg},
+            },
+            {
+                title   => 'Bugs',
+                data    => $cache->{bts}{$pkg},
+            },
+        ],
+    },
+);
 exit 0;
 

Added: scripts/qa/templates/pkginfo
URL: http://svn.debian.org/wsvn/scripts/qa/templates/pkginfo?rev=20269&op=file
==============================================================================
--- scripts/qa/templates/pkginfo (added)
+++ scripts/qa/templates/pkginfo Thu May 22 10:11:12 2008
@@ -1,0 +1,9 @@
+<table>
+    [% FOREACH s IN sections %]
+    <tr><th>$s.title</th></tr>
+    <tr><td><table>
+    [% FOREACH data IN s.data %]
+    <tr><td>$data.key</td><td>$data.value</td></tr>
+    [% END # FREACH data %]
+    [% END # FOREACH sections %]
+</table>




More information about the Pkg-perl-cvs-commits mailing list