[yelp-xsl] Move linktrails stubs to common for all source formats to use



commit 792ce9dd6511758e43f98427d0212bd35f654c7a
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Oct 2 17:00:43 2015 -0400

    Move linktrails stubs to common for all source formats to use

 xslt/common/html.xsl                |   33 ++++++++++++++++++++++++++++++++
 xslt/dita/html/dita2html-topic.xsl  |   12 ++++++++++-
 xslt/docbook/html/db2html-links.xsl |   21 ++++++++++++++++---
 xslt/mallard/html/mal2html-page.xsl |   36 +++++++++++++++++++++++-----------
 4 files changed, 85 insertions(+), 17 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index b1db80b..9629821 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -492,6 +492,39 @@ to provide additional elements in the HTML #{head} element of output files.
 
 
 <!--**==========================================================================
+html.linktrails.empty
+Stub to output something when no link trails are present.
+:Stub: true
+:Revision:version="3.20" date="2015-10-02" status="final"
+$node: The source element a page is bring created for.
+
+This template is a stub. It is called by templates that output link trails when
+there are no link trails to output. Some customizations prepend extra site links
+to link trails. This template allows them to output those links even when no link
+trails would otherwise be present.
+-->
+<xsl:template name="html.linktrails.empty">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+
+<!--**==========================================================================
+html.linktrails.prefix
+Stub to output extra content before a link trail.
+:Stub: true
+:Revision:version="3.20" date="2015-10-02" status="final"
+$node: A source-specific element providing information about the link trail.
+
+This template is a stub. It is called by templates that output link trails
+before the normal links are output. This template is useful for adding extra
+site links at the beginning of each link trail.
+-->
+<xsl:template name="html.linktrails.prefix">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+
+<!--**==========================================================================
 html.class.attr
 Output a #{class} attribute for an HTML element.
 :Revision: version="3.10" date="2013-07-10" status="final"
diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl
index fdf6f30..be1edfe 100644
--- a/xslt/dita/html/dita2html-topic.xsl
+++ b/xslt/dita/html/dita2html-topic.xsl
@@ -340,6 +340,13 @@ REMARK: Describe this module
   </xsl:choose>
 </xsl:template>
 
+<!-- = map % html.header.mode = -->
+<xsl:template mode="html.header.mode" match="&map_map;">
+  <xsl:call-template name="html.linktrails.empty">
+    <xsl:with-param name="node" select="."/>
+  </xsl:call-template>
+</xsl:template>
+
 <!-- = map % html.footer.mode = -->
 <xsl:template mode="html.footer.mode" match="&map_map;">
   <xsl:call-template name="dita2html.topic.about"/>
@@ -392,6 +399,9 @@ REMARK: Describe this module
   </xsl:variable>
   <div class="trails" role="navigation">
     <div class="trail">
+      <xsl:call-template name="html.linktrails.prefix">
+        <xsl:with-param name="node" select="$node"/>
+      </xsl:call-template>
       <a class="trail">
         <xsl:attribute name="href">
           <xsl:for-each select="str:split($node/@href, '/')">
@@ -408,7 +418,7 @@ REMARK: Describe this module
         </xsl:call-template>
       </a>
       <xsl:value-of select="$sep"/>
-      <xsl:for-each select="ancestor::&map_topicref;">
+      <xsl:for-each select="(ancestor::&map_topicref;)">
         <xsl:choose>
           <xsl:when test="@href">
             <a class="trail">
diff --git a/xslt/docbook/html/db2html-links.xsl b/xslt/docbook/html/db2html-links.xsl
index d136bf9..af0ebcf 100644
--- a/xslt/docbook/html/db2html-links.xsl
+++ b/xslt/docbook/html/db2html-links.xsl
@@ -32,19 +32,26 @@ This stylesheet contains templates to handle implicit automatic links.
 <!--**==========================================================================
 db2html.links.linktrail
 Generate links to pages from ancestor elements.
-:Revision:version="3.4" date="2011-11-08" status="final"
+:Revision:version="3.20" date="2015-09-15" status="final"
 $node: The element to generate links for.
 
-This template outputs a trail of links for the ancestor pages of ${node}.
+This template outputs a trail of links for the ancestor pages of ${node}. If
+${node} has no ancestors, then it calls *{html.linktrails.empty} instead. This
+template calls *{html.linktrails.prefix} before the first link, passing ${node}
+as that template's #{node} parameter.
 -->
 <xsl:template name="db2html.links.linktrail">
   <xsl:param name="node" select="."/>
   <xsl:variable name="direction">
     <xsl:call-template name="l10n.direction"/>
   </xsl:variable>
-  <xsl:if test="$node/ancestor::*">
+  <xsl:choose>
+    <xsl:when test="$node/ancestor::*">
     <div class="trails" role="navigation">
       <div class="trail">
+        <xsl:call-template name="html.linktrails.prefix">
+          <xsl:with-param name="node" select="$node"/>
+        </xsl:call-template>
         <!-- The parens put the nodes back in document order -->
         <xsl:for-each select="($node/ancestor::*)">
           <a class="trail">
@@ -76,7 +83,13 @@ This template outputs a trail of links for the ancestor pages of ${node}.
         </xsl:for-each>
       </div>
     </div>
-  </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="html.linktrails.empty">
+        <xsl:with-param name="node" select="$node"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 5a9f111..79724aa 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -298,11 +298,14 @@ on each one. Otherwise, it calls the stub template *{mal2html.page.linktrails.em
 
 <!--**==========================================================================
 mal2html.page.linktrails.empty
-Stub to output something when no link trails are present.
+Deprecated stub to output something when no link trails are present.
 :Stub: true
-:Revision:version="3.4" date="2011-11-19" status="final"
+:Revision:version="3.20" date="2015-09-17" status="final"
 $node: The top-level #{page} element.
 
+This template is deprecated. Use *{html.linktrails.empty} instead. By default,
+this template calls *{html.linktrails.empty}, passing the ${node} parameter.
+
 This template is a stub. It is called by ${mal2html.page.linktrails} when there
 are no link trails to output. Some customizations prepend extra site links to
 link trails. This template allows them to output those links even when no link
@@ -310,19 +313,22 @@ trails would otherwise be present.
 -->
 <xsl:template name="mal2html.page.linktrails.empty">
   <xsl:param name="node" select="."/>
+  <xsl:call-template name="html.linktrails.empty">
+    <xsl:with-param name="node" select="$node"/>
+  </xsl:call-template>
 </xsl:template>
 
 
 <!--**==========================================================================
 mal2html.page.linktrails.trail
 Output one trail of guide links.
-:Revision:version="3.4" date="2011-11-19" status="final"
+:Revision:version="3.20" date="2015-09-19" status="final"
 $node: A #{link} element from *{mal.link.linktrails}.
 
 This template outputs an HTML #{div} element containing all the links in a
-single link trail. It calls *{mal2html.page.linktrails.trail.prefix} to output
-a custom boilerplate prefix, then calls *{mal2html.page.linktrails.link} to
-output the actual links.
+single link trail. It calls *{html.linktrails.prefix} (by way of 
+*{mal2html.page.linktrails.trail.prefix}) to output a custom boilerplate prefix,
+then calls *{mal2html.page.linktrails.link} to output the actual links.
 -->
 <xsl:template name="mal2html.page.linktrails.trail">
   <xsl:param name="node" select="."/>
@@ -339,18 +345,24 @@ output the actual links.
 
 <!--**==========================================================================
 mal2html.page.linktrails.trail.prefix
-Stub to output extra content before a link trail.
+Deprecated stub to output extra content before a link trail.
 :Stub: true
-:Revision:version="3.4" date="2011-11-19" status="final"
+:Revision:version="3.20" date="2015-09-17" status="final"
 $node: A #{link} element from *{mal.link.linktrails}.
 
-This template is a stub. It is called by *{mal2html.page.linktrails.trail} for each
-link trail before the normal links are output with *{mal2html.page.linktrails.link}.
-This template is useful for adding extra site links at the beginning of each link
-trail.
+This template is deprecated. Use *{html.linktrails.prefix} instead. By default,
+this template calls *{html.linktrails.prefix}, passing the ${node} parameter.
+
+This template is a stub. It is called by *{mal2html.page.linktrails.trail} for
+each link trail before the normal links are output with
+*{mal2html.page.linktrails.link}. This template is useful for adding extra site
+links at the beginning of each link trail.
 -->
 <xsl:template name="mal2html.page.linktrails.trail.prefix">
   <xsl:param name="node" select="."/>
+  <xsl:call-template name="html.linktrails.prefix">
+    <xsl:with-param name="node" select="$node"/>
+  </xsl:call-template>
 </xsl:template>
 
 


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