Bug#255920: packages.qa.debian.org: package names should be URL-encoded
From: Raphael Hertzog <hertzog@debian.org>
Subject: Re: Bug#255920: packages.qa.debian.org: package names should be URL-encoded
Date: Thu, 24 Jun 2004 19:23:34 +0200
> I know this problem for quite some time ... but I don't know how to do
> that correction with XSLT !
>
> Because it's in the stylesheet that I need to make that conversion.
> Patch, input or anything else appreciated. :)
>
> Code is in cvs.debian.org/cvs/qa module "pts" (file is www/xsl/pts.xsl)
Here is a patch for pts.xsl.
I tried to write a template to URL-encode (or URL-escape) a given package name,
and found that function already added to this XSL file in r1.16 on 2003-03-13.
(It was just the same as what I intended to write.)
The problem was simply that the template was not applied to all of package
names in the URLs.
So I applied it for all the URLs in this patch.
Since I don't have XML files to be transformed with this XSL file,
and I don't know the data structure of those files,
I can't test whether this XSL file can transform correctly.
I hope it would work.
Because Debian package names can contain only lowercase letters, numbers,
and the "-" and "+" characters,
only a function to convert "+" to "%2b" is required to solve the URL-encoding
problem.
So, if this patch can make pts.xsl process "+" correctly,
this bug (Bug#255920) might as well be closed.
Even if this bug is closed,
a portion of links will remain to be broken because of Bug#236773.
(e.g. a link in http://packages.qa.debian.org/libg/libg++27.html to
http://packages.debian.org/libg++27 (or http://packages.debian.org/libg%2b%2b27))
Cheers,
--
|: Noritada KOBAYASHI
|: Dept. of General Systems Studies,
|: Graduate School of Arts and Sciences, Univ. of Tokyo
|: E-mail: nori1@dolphin.c.u-tokyo.ac.jp (preferable)
|: nori@esa.c.u-tokyo.ac.jp
--- pts.xsl.orig Sat Jun 26 00:33:03 2004
+++ pts.xsl Sat Jun 26 02:58:51 2004
@@ -157,9 +157,17 @@
<tr class="normalrow">
<td class="labelcell">All bugs</td>
<td class="contentcell">
- <a href="http://bugs.debian.org/src:{$package}"><xsl:if test="$hasother">
- <xsl:value-of select="$other/bugs/@all"/>
- </xsl:if></a>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://bugs.debian.org/src:</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="$hasother">
+ <xsl:value-of select="$other/bugs/@all"/>
+ </xsl:if>
+ </xsl:element>
</td>
</tr>
<tr class="normalrow">
@@ -390,22 +398,83 @@
<tr>
<td class="contentcell" colspan="2" style="text-align: left">
<xsl:if test="architecture!='all'">
- <li><a href="http://buildd.debian.org/build.php?pkg={$package}">Buildd logs</a></li>
+ <li>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://buildd.debian.org/build.php?pkg=</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ Buildd logs
+ </xsl:element>
+ </li>
</xsl:if>
<!-- DISABLED until ddtp.debian.org is back up
- <li><a href="http://ddtp.debian.org/stats/pdesc/report.cgi?package={$package}&lang=all&type=src-drvbin&subword=0">Description's translations (DDTP)</a></li>
+ <li>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://ddtp.debian.org/stats/pdesc/report.cgi?package=</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>&lang=all&type=src-drvbin&subword=0</xsl:text>
+ </xsl:attribute>
+ Description's translations (DDTP)
+ </xsl:element>
+ </li>
<xsl:if test="$other/@debconf='yes'">
- <li><a href="http://ddtp.debian.org/cgi-bin/ddtp.cgi?part=debconf&package={$package}">Debconf templates's translations (DDTP)</a></li>
+ <li>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://ddtp.debian.org/cgi-bin/ddtp.cgi?part=debconf&package=</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ Debconf templates's translations (DDTP)
+ </xsl:element>
+ </li>
</xsl:if>
-->
<xsl:if test="$hasunstable and $other/debcheck/@unstable='yes'">
- <li><a href="http://qa.debian.org/debcheck.php?dist=unstable&package={$package}">Debcheck on unstable</a></li>
+ <li>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://qa.debian.org/debcheck.php?dist=unstable&package=</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ Debcheck on unstable
+ </xsl:element>
+ </li>
</xsl:if>
<xsl:if test="$hastesting and $other/debcheck/@testing='yes'">
- <li><a href="http://qa.debian.org/debcheck.php?dist=testing&package={$package}">Debcheck on testing</a></li>
+ <li>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://qa.debian.org/debcheck.php?dist=testing&package=</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ Debcheck on testing
+ </xsl:element>
+ </li>
</xsl:if>
<xsl:if test="$hasstable and $other/debcheck/@stable='yes'">
- <li><a href="http://qa.debian.org/debcheck.php?dist=stable&package={$package}">Debcheck on stable</a></li>
+ <li>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://qa.debian.org/debcheck.php?dist=stable&package=</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ Debcheck on stable
+ </xsl:element>
+ </li>
</xsl:if>
<!-- convert maintainer/name to follow lintian.debian.org convention [FG] -->
<xsl:variable name="pattern" select="concat('àáèéëêòöøîìùñ-/()" ', "'")"/>
@@ -502,7 +571,17 @@
<li>The package has not yet entered <a
href="http://ftp-master.debian.org/testing/update_excuses.html.gz#{$package}">testing</a>
even though the <xsl:value-of select="document(concat('../base/', $dir, '/excuse.xml'))/excuse/@limit"/>-day
- delay is over. <a href="http://bjorn.haxx.se/debian/testing.pl?package={$package}">Check why</a>.</li>
+ delay is over.
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:text>http://bjorn.haxx.se/debian/testing.pl?package=</xsl:text>
+ <xsl:call-template name="escape-name">
+ <xsl:with-param name="text"><xsl:value-of select="$package"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ Check why
+ </xsl:element>
+ .</li>
</xsl:if>
<xsl:if test="not(starts-with(standards-version, $lastmajorsv))">
<li>The package is severly out of date with respect to the Debian
Reply to: