diff options
author | randomdan <randomdan@localhost> | 2010-09-29 16:42:19 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2010-09-29 16:42:19 +0000 |
commit | 35180f2e054d701f8906b3e036b4e23bad7efdde (patch) | |
tree | 91927eb42b7d6567015a9327b56bce1e8cf283aa /gentoobrowse/package.xslt | |
parent | Handle null fields (diff) | |
download | gentoobrowse-35180f2e054d701f8906b3e036b4e23bad7efdde.tar.bz2 gentoobrowse-35180f2e054d701f8906b3e036b4e23bad7efdde.tar.xz gentoobrowse-35180f2e054d701f8906b3e036b4e23bad7efdde.zip |
Split the browse stylesheet into it's component parts, add some SEO stuff
Diffstat (limited to 'gentoobrowse/package.xslt')
-rw-r--r-- | gentoobrowse/package.xslt | 199 |
1 files changed, 199 insertions, 0 deletions
diff --git a/gentoobrowse/package.xslt b/gentoobrowse/package.xslt new file mode 100644 index 0000000..bc0187a --- /dev/null +++ b/gentoobrowse/package.xslt @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:project2="http://project2.randomdan.homeip.net/" exclude-result-prefixes="project2" > + <xsl:import href="base.xslt" /> + <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes" + doctype-system="http://www.w3.org/TR/html4/loose.dtd" + doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" /> + <xsl:template name="head"> + <title><xsl:value-of select="/gentoo/summary/package/pkgname" /> (in <xsl:value-of select="/gentoo/summary/package/catname" />) Package Details - Gentoo Browse</title> + <meta name="description"> + <xsl:attribute name="content"><xsl:value-of select="/gentoo/summary/package/description" /></xsl:attribute> + </meta> + </xsl:template> + <xsl:template name="content"> + <xsl:apply-templates select="/gentoo/summary/package" /> + </xsl:template> + <xsl:template match="/gentoo/summary/package/versions"> + <div class="tabvisible" id="versions"> + <ul> + <xsl:apply-templates select="version" /> + </ul> + </div> + </xsl:template> + <xsl:template match="/gentoo/summary/package/versions/version"> + <li> + <span class="ver">v<xsl:value-of select="version" /></span> + (<i>Modified :</i> <xsl:value-of select="moddate" /><xsl:text> </xsl:text> + <i>Slot :</i> <xsl:value-of select="slot" /> + <xsl:if test="license"><xsl:text> </xsl:text> + <i>License :</i> <xsl:value-of select="license" /> + </xsl:if>) + <xsl:if test="count(../../maskstatus/mask[ebuildid=current()/ebuildid]) > 0"> + <span class="masked">(Masked + <xsl:for-each select="../../maskstatus/mask[ebuildid=current()/ebuildid]"> + <xsl:value-of select="setno" /> + </xsl:for-each>) + </span> + </xsl:if> + <ul> + <li> + <xsl:for-each select="../../versionArchs/arch[ebuildid=current()/ebuildid]"> + <xsl:sort select="arch" /> + <xsl:value-of select="arch" /> + <xsl:text> </xsl:text> + </xsl:for-each> + </li> + <li> + <xsl:for-each select="../../versionUses/use[ebuildid=current()/ebuildid]"> + <xsl:sort select="use" /> + <xsl:value-of select="use" /> + <xsl:text> </xsl:text> + </xsl:for-each> + </li> + </ul> + </li> + </xsl:template> + <xsl:template match="/gentoo/summary/package"> + <script language="javascript" type="text/javascript"> + function showTab(name) + { + var children = document.getElementById('tabcontainer').childNodes; + for(var c = 0; c < children.length; c++) { + if (children[c].className == 'tabvisible') { + children[c].className = 'tabhidden'; + } + } + document.getElementById(name).className = 'tabvisible'; + } + </script> + <xsl:if test="count(/gentoo/project2:session/project2:var[@name='loggedInUserID']) != 0"> + <xsl:if test="count(tracks/track) > 0"> + <form method="post" class="tracker"> + <xsl:attribute name="action">/untrack/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></xsl:attribute> + <input type="hidden" name="packageid"> + <xsl:attribute name="value"> + <xsl:value-of select="/gentoo/summary/package/packageid" /> + </xsl:attribute> + </input> + <input type="submit" value="Untrack" /> + </form> + </xsl:if> + <xsl:if test="count(tracks/track) = 0"> + <form method="post" class="tracker"> + <xsl:attribute name="action">/track/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></xsl:attribute> + <input type="hidden" name="packageid"> + <xsl:attribute name="value"> + <xsl:value-of select="/gentoo/summary/package/packageid" /> + </xsl:attribute> + </input> + <input type="submit" value="Track" /> + </form> + </xsl:if> + </xsl:if> + <xsl:apply-templates select="packageUrls" /> + <h2> + <a> + <xsl:attribute name="href"> + /category/<xsl:value-of select="catname" /> + </xsl:attribute> + <xsl:value-of select="catname" /> + </a>/<xsl:value-of select="pkgname" /> + </h2> + <p> + <xsl:value-of select="description" /> + </p> + <div class="tabstrip"> + <!-- handles --> + <h3 class="tabhandle"><a href="javascript:showTab('versions');">Versions</a></h3> + <xsl:if test="count(/gentoo/summary/package/deps/package) > 0"> + <h3 class="tabhandle"><a href="javascript:showTab('deps');">Dependencies</a></h3> + </xsl:if> + <xsl:if test="count(/gentoo/summary/package/packageBugs/bug) > 0"> + <h3 class="tabhandle"><a href="javascript:showTab('bugs');">Open bugs</a></h3> + </xsl:if> + <xsl:if test="count(/gentoo/summary/package/maskdetails/mask) > 0"> + <h3 class="tabhandle"><a href="javascript:showTab('masks');">Masks</a></h3> + </xsl:if> + <xsl:if test="count(/gentoo/summary/package/changelog/line) > 0"> + <h3 class="tabhandle"><a href="javascript:showTab('changelog');">Change log</a></h3> + </xsl:if> + </div> + <div class="tabbox" id="tabcontainer"> + <!-- content --> + <xsl:apply-templates select="versions" /> + <xsl:apply-templates select="deps" /> + <xsl:apply-templates select="packageBugs" /> + <xsl:apply-templates select="maskdetails" /> + <xsl:apply-templates select="changelog" /> + <div style="clear; both" /> + </div> + </xsl:template> + + <!-- Package URLs --> + <xsl:template match="/gentoo/summary/package/packageUrls"> + <div class="urls"> + <xsl:for-each select="url"> + <a target="_blank"> + <xsl:attribute name="href"> + <xsl:value-of select="url" /> + </xsl:attribute> + <xsl:value-of select="url" /> + </a> + <br /> + </xsl:for-each> + </div> + </xsl:template> + + <!-- Package bugs --> + <xsl:template match="/gentoo/summary/package/packageBugs"> + <xsl:if test="count(/gentoo/summary/package/packageBugs/bug) > 0"> + <ul class="tabhidden" id="bugs"> + <xsl:for-each select="bug"> + <li> + <a target="_blank"> + <xsl:attribute name="href">http://bugs.gentoo.org/<xsl:value-of select="bugid" /></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="summary" /></xsl:attribute> + <xsl:value-of select="bugid" /> + </a> + - <xsl:value-of select="summary" /> + </li> + </xsl:for-each> + </ul> + </xsl:if> + </xsl:template> + + <!-- Change log --> + <xsl:template match="/gentoo/summary/package/changelog"> + <xsl:if test="count(/gentoo/summary/package/changelog/line) > 0"> + <div class="tabhidden" id="changelog"> + <xsl:for-each select="line"> + <p><xsl:value-of select="content" /></p> + </xsl:for-each> + </div> + </xsl:if> + </xsl:template> + + <!-- Package dependencies --> + <xsl:template match="/gentoo/summary/package/deps"> + <xsl:if test="count(/gentoo/summary/package/deps/package) > 0"> + <ul class="tabhidden" id="deps"> + <xsl:apply-templates match="/gentoo/summary/package/deps/package" /> + </ul> + </xsl:if> + </xsl:template> + + <!-- Package mask details --> + <xsl:template match="/gentoo/summary/package/maskdetails"> + <xsl:if test="count(/gentoo/summary/package/maskdetails/mask) > 0"> + <ol class="tabhidden" id="masks"> + <xsl:for-each select="mask"> + <li> + <xsl:value-of select="person" /> (<i>Added: </i><xsl:value-of select="dateadded" />) + <ul><li><xsl:value-of select="message" /></li></ul> + </li> + </xsl:for-each> + </ol> + </xsl:if> + </xsl:template> +</xsl:stylesheet> |