public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Alec Warner" <antarus@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/www-redesign:master commit in: xml/htdocs/xsl/
Date: Fri,  4 Mar 2011 06:50:54 +0000 (UTC)	[thread overview]
Message-ID: <4dec7f7225172a511ab6f40dd5117c4f6cee1f26.antarus@gentoo> (raw)

commit:     4dec7f7225172a511ab6f40dd5117c4f6cee1f26
Author:     Alec Warner <antarus <AT> scriptkitty <DOT> com>
AuthorDate: Mon Sep 13 01:09:00 2010 +0000
Commit:     Alec Warner <antarus <AT> gentoo <DOT> org>
CommitDate: Mon Sep 13 01:09:00 2010 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/www-redesign.git;a=commit;h=4dec7f72

Split the function that determines what image we are using into its own template

---
 xml/htdocs/xsl/newscontent.xsl |   94 +++++++++++++++++++++------------------
 1 files changed, 51 insertions(+), 43 deletions(-)

diff --git a/xml/htdocs/xsl/newscontent.xsl b/xml/htdocs/xsl/newscontent.xsl
index e560c98..b9fd65d 100644
--- a/xml/htdocs/xsl/newscontent.xsl
+++ b/xml/htdocs/xsl/newscontent.xsl
@@ -1,6 +1,50 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-    
+
+
+  <xsl:template name="news-icon-selector">
+    <xsl:param name="category"/>
+    <xsl:choose>
+      <xsl:when test="$category='birthday'">
+        <img class="newsicon" src="/images/birthday_cake.png" alt="Happy Birthday"/>
+      </xsl:when>
+      <xsl:when test="$category='gentoo'">
+        <img class="newsicon" src="/images/icon-gentoo.png" alt="gentoo"/>
+      </xsl:when>
+      <xsl:when test="$category='main'">
+        <img class="newsicon" src="/images/icon-stick.png" alt="stick man"/>
+      </xsl:when>
+      <xsl:when test="$category='linux'">
+        <img class="newsicon" src="/images/icon-penguin.png" alt="tux"/>
+      </xsl:when>
+      <xsl:when test="$category='moo'">
+        <img class="newsicon" src="/images/icon-cow.png" alt="Larry the Cow"/>
+      </xsl:when>
+      <xsl:when test="$category='plans'">
+        <img class="newsicon" src="/images/icon-clock.png" alt="Clock"/>
+      </xsl:when>
+      <xsl:when test="$category='planet'">
+        <img class="newsicon" src="/images/G-Earth.png" alt="Planet Earth"/>
+      </xsl:when>
+      <!-- old ones, kept to display very very old news items -->
+      <xsl:when test="$category='alpha'">
+        <img class="newsicon" src="/images/icon-alpha.gif" alt="AlphaServer GS160"/>
+      </xsl:when>
+      <xsl:when test="$category='kde'">
+        <img class="newsicon" src="/images/icon-kde.png" alt="KDE"/>
+      </xsl:when>
+      <xsl:when test="$category='ibm'">
+        <img class="newsicon" src="/images/icon-ibm.gif" alt="ibm"/>
+      </xsl:when>
+      <xsl:when test="$category='nvidia'">
+        <img class="newsicon" src="/images/icon-nvidia.png" alt="Nvidia"/>
+      </xsl:when>
+      <xsl:when test="$category='freescale'">
+        <img class="newsicon" src="/images/icon-freescale.gif" alt="Freescale Semiconductor"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
   <!--
   TODO(antarus): What does this actually do?  Does anything still use it?
 
@@ -8,9 +52,9 @@
   TODO(antarus): The icon selector should be its own template.
   -->
   <xsl:template name="newscontent">
-  <xsl:param name="thenews"/>
-  <xsl:param name="summary"/>
-  <xsl:param name="link"/>
+    <xsl:param name="thenews"/>
+    <xsl:param name="summary"/>
+    <xsl:param name="link"/>
 
     <div class="news">
       <p class="newshead" lang="en">
@@ -34,45 +78,9 @@
         </font>
       </p>
 
-      <xsl:choose>
-        <xsl:when test="$thenews/@category='birthday'">
-          <img class="newsicon" src="/images/birthday_cake.png" alt="Happy Birthday"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='gentoo'">
-          <img class="newsicon" src="/images/icon-gentoo.png" alt="gentoo"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='main'">
-          <img class="newsicon" src="/images/icon-stick.png" alt="stick man"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='linux'">
-          <img class="newsicon" src="/images/icon-penguin.png" alt="tux"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='moo'">
-          <img class="newsicon" src="/images/icon-cow.png" alt="Larry the Cow"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='plans'">
-          <img class="newsicon" src="/images/icon-clock.png" alt="Clock"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='planet'">
-          <img class="newsicon" src="/images/G-Earth.png" alt="Planet Earth"/>
-        </xsl:when>
-        <!-- old ones, kept to display very very old news items -->
-        <xsl:when test="$thenews/@category='alpha'">
-          <img class="newsicon" src="/images/icon-alpha.gif" alt="AlphaServer GS160"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='kde'">
-          <img class="newsicon" src="/images/icon-kde.png" alt="KDE"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='ibm'">
-          <img class="newsicon" src="/images/icon-ibm.gif" alt="ibm"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='nvidia'">
-          <img class="newsicon" src="/images/icon-nvidia.png" alt="Nvidia"/>
-        </xsl:when>
-        <xsl:when test="$thenews/@category='freescale'">
-          <img class="newsicon" src="/images/icon-freescale.gif" alt="Freescale Semiconductor"/>
-        </xsl:when>
-      </xsl:choose>
+      <xsl:call-template name="news-icon-selector">
+        <xsl:with-param name="category" select="$thenews/@category"/>
+      </xsl:call-template>
 
       <div class="newsitem">
       <xsl:choose>



             reply	other threads:[~2011-03-04  6:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04  6:50 Alec Warner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-04-01  5:46 [gentoo-commits] proj/www-redesign:master commit in: xml/htdocs/xsl/ Alec Warner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4dec7f7225172a511ab6f40dd5117c4f6cee1f26.antarus@gentoo \
    --to=antarus@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox