[epiphany] epiphany-bookmarks-html.xsl: prioritize smart link URIs over regular links



commit afc5412ee87d1bf9bae16ff1c2b6ea7e3043d1e2
Author: William Ting <william h ting gmail com>
Date:   Tue Apr 3 22:42:56 2012 +0900

    epiphany-bookmarks-html.xsl: prioritize smart link URIs over regular links
    
    When exporting bookmarks to HTML, certain smart link metadata is lost that would
    otherwise be preserved in RDF / XML format. Now smart link URIs are used in
    place of regular link URIs if they exist.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=534565

 data/epiphany-bookmarks-html.xsl |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/data/epiphany-bookmarks-html.xsl b/data/epiphany-bookmarks-html.xsl
index 702b14b..680007b 100644
--- a/data/epiphany-bookmarks-html.xsl
+++ b/data/epiphany-bookmarks-html.xsl
@@ -4,6 +4,7 @@
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
   xmlns:purl="http://purl.org/rss/1.0/";
   xmlns:dc="http://purl.org/dc/elements/1.1/";
+  xmlns:ephy="http://gnome.org/ns/epiphany#";
   exclude-result-prefixes="dc purl rdf">
 <!--
 Copyright  2004 Stefan Rotsch
@@ -48,7 +49,15 @@ $Id$
         <dt><h3><xsl:value-of select="." /></h3><dl>
         <xsl:for-each select="key('topics', .)">
             <xsl:sort select="purl:title" />
-            <dt><a href="{./purl:link}"><xsl:value-of select="./purl:title" /></a></dt>
+                <!-- Use smart link URIs if they exist, see bug #534565 -->
+                <xsl:choose>
+                    <xsl:when test="ephy:smartlink">
+                        <dt><a href="{./ephy:smartlink}"><xsl:value-of select="./purl:title" /></a></dt>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <dt><a href="{./purl:link}"><xsl:value-of select="./purl:title" /></a></dt>
+                    </xsl:otherwise>
+                </xsl:choose>
         </xsl:for-each>
 
         <!-- Force a linebreak; otherwise thinks will break for Topics with only 1 item -->
@@ -60,9 +69,17 @@ $Id$
     <!-- Now Bookmarks without topics will be added at the bottom of the output file -->
     <xsl:for-each select="purl:item">
         <xsl:sort select="./purl:title" />
-        <xsl:if test="not(dc:subject)">
-            <dt><a href="{./purl:link}"><xsl:value-of select="./purl:title" /></a></dt>
-        </xsl:if>
+            <xsl:if test="not(dc:subject)">
+                <!-- Use smart link URIs if they exist, see bug #534565 -->
+                <xsl:choose>
+                    <xsl:when test="ephy:smartlink">
+                        <dt><a href="{./ephy:smartlink}"><xsl:value-of select="./purl:title" /></a></dt>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <dt><a href="{./purl:link}"><xsl:value-of select="./purl:title" /></a></dt>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:if>
     </xsl:for-each>
 
     <!-- Closing tag of outer dl -->



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]