Attached a patch that would encode HTML special chars in the short
description (see #181872 for a similar discussion on long
descriptions) both in all_packages and in the packages pages.

The lines handling & are commented out. See the corresponding
discussion in the bug mentioned above.

Greetings,
        Frank

Index: htmlscripts/pages.pl
===================================================================
RCS file: /cvs/webwml/packages/htmlscripts/pages.pl,v
retrieving revision 1.10
diff -u -IMD5 -r1.10 pages.pl
--- htmlscripts/pages.pl        24 Mar 2003 15:05:57 -0000      1.10
+++ htmlscripts/pages.pl        29 Mar 2003 15:23:42 -0000
@@ -113,7 +113,11 @@
                if ($distrib =~ /(contrib|non-free|non-us|security)/o) {
                        $all_package .= " [<font 
color=\"red\">$distrib</font>]\n";
                }
-               $all_package .= "\n     <dd>".$package{$_}{'short-desc'}."\n";
+               my $short_desc = $package{$_}{'short-desc'};
+#              $short_desc =~ s/&/\&amp\;/go;
+               $short_desc =~ s/</\&lt\;/go;
+               $short_desc =~ s/>/\&gt\;/go;
+               $all_package .= "\n     <dd>".$short_desc."\n";
        }
        $all_package .= "</dl>\n";
        $all_package .= trailer('../..');
@@ -161,6 +165,9 @@
                }
                $short_desc = $package{$pack}{'short-desc'};
                $long_desc = $package{$pack}{'long-desc'};
+#              $short_desc =~ s/\&/\&amp\;/go;
+               $short_desc =~ s/</\&lt\;/go;
+               $short_desc =~ s/>/\&gt\;/go;
                $long_desc =~ s,<((URL:)?http://[\S~-]+?/?)>,\&lt\;$1\&gt\;,go;
                $long_desc =~ 
s,(http://[\S~-]+?/?)((\&gt\;)?[)]?[']?[.\,]?(\s|$)),<a href=\"$1\">$1</a>$2,go;
                $long_desc =~ s/\A //o;

-- 
*** Frank Lichtenheld <[EMAIL PROTECTED]> ***
          *** http://www.djpig.de/ ***
see also: - http://www.usta.de/
          - http://fachschaft.physik.uni-karlsruhe.de/

Reply via email to