[yelp-xsl] Fixing up previous and next links for DocBook and Mallard



commit 9e90b007e7dcba15297750f55ba4edbc839fe7ef
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Jan 7 14:39:08 2011 -0500

    Fixing up previous and next links for DocBook and Mallard

 changes                                |    7 ++
 xslt/common/html.xsl                   |   25 ++++++
 xslt/docbook/common/db-chunk.xsl       |    4 +-
 xslt/docbook/html/db2html-css.xsl      |   32 -------
 xslt/docbook/html/db2html-division.xsl |  146 ++++++++++++++------------------
 xslt/mallard/html/mal2html-page.xsl    |   57 +++++++-----
 6 files changed, 131 insertions(+), 140 deletions(-)
---
diff --git a/changes b/changes
new file mode 100644
index 0000000..af3a5cc
--- /dev/null
+++ b/changes
@@ -0,0 +1,7 @@
+Changes in 2.91.7
+=================
+* Added support for Mallard Facets extension
+* Fixed incorrect handling of topic link groups
+* Added automatic syntax highlighting using jQuery.Syntax
+* Implemented sidebar style for notes
+* Added support for line numbering in Mallard code blocks
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index e90dc56..3a1c95a 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -583,6 +583,11 @@ div:first-child, pre:first-child, p:first-child { margin-top: 0; }
 div.inner, div.contents, pre.contents { margin-top: 0; }
 pre.contents div { margin-top: 0 !important; }
 p img { vertical-align: middle; }
+div.clear {
+  margin: 0; padding: 0;
+  height: 0; line-height: 0;
+  clear: both;
+}
 
 table {
   border-collapse: collapse;
@@ -724,6 +729,26 @@ div.sectionlinks div.sectionlinks {
 div.sectionlinks div.sectionlinks li {
   padding-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.44em;
 }
+div.nextlinks {
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.2em;
+  float: </xsl:text><xsl:value-of select="$right"/><xsl:text>;
+  clear: both;
+}
+a.nextlinks-prev::before {
+  content: '</xsl:text><xsl:choose>
+  <xsl:when test="$left = 'left'"><xsl:text>&#x25C0;&#x00A0;&#x00A0;</xsl:text></xsl:when>
+  <xsl:otherwise><xsl:text>&#x25B6;&#x00A0;&#x00A0;</xsl:text></xsl:otherwise>
+  </xsl:choose><xsl:text>';
+  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
+  vertical-align: bottom;
+}
+a.nextlinks-next::after {
+  content: '</xsl:text><xsl:choose>
+  <xsl:when test="$left = 'left'"><xsl:text>&#x00A0;&#x00A0;&#x25B6;</xsl:text></xsl:when>
+  <xsl:otherwise><xsl:text>&#x00A0;&#x00A0;&#x25C0;</xsl:text></xsl:otherwise>
+  </xsl:choose><xsl:text>';
+  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
+}
 pre.numbered {
   margin: 0;
   padding: 0.5em;
diff --git a/xslt/docbook/common/db-chunk.xsl b/xslt/docbook/common/db-chunk.xsl
index 5d147b3..b36a655 100644
--- a/xslt/docbook/common/db-chunk.xsl
+++ b/xslt/docbook/common/db-chunk.xsl
@@ -400,9 +400,9 @@ REMARK: Explain how this works, and what the axes are
         </xsl:when>
         <xsl:when test="$node/..">
           <xsl:call-template name="db.chunk.chunk-id">
-            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="node" select="$node/.."/>
             <xsl:with-param name="depth_in_chunk" select="0"/>
-            <xsl:with-param name="chunk" select="$node"/>
+            <xsl:with-param name="chunk" select="$node/.."/>
           </xsl:call-template>
         </xsl:when>
       </xsl:choose>
diff --git a/xslt/docbook/html/db2html-css.xsl b/xslt/docbook/html/db2html-css.xsl
index 046fa05..8fd85b1 100644
--- a/xslt/docbook/html/db2html-css.xsl
+++ b/xslt/docbook/html/db2html-css.xsl
@@ -116,38 +116,6 @@ tfoot { border-top: solid 2px; border-bottom: solid 2px; }
 
 div.title span.label { font-weight: normal; }
 
-<!-- == navbar == -->
-div.navbar {
- margin: 1em 0 1em 0;
-  padding: 0.5em 1em 0.5em 1em;
-  clear: both;
-  background-color: </xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>;
-  border: solid 1px </xsl:text><xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
-}
-div.head div.navbar:first-child { margin-top: 0; }
-div.navbar img { border: 0; vertical-align: -0.4em; }
-table.navbar { width: 100%; margin: 0; border: none; }
-table.navbar td { padding: 0; border: none; }
-td.navbar-next {
-  text-align: </xsl:text><xsl:value-of select="$right"/><xsl:text>;
-}
-a.navbar-prev::before {
-  <!-- FIXME: rtl -->
-  content: '</xsl:text><xsl:choose>
-  <xsl:when test="$left = 'left'"><xsl:text>&#x25C0;&#x00A0;&#x00A0;</xsl:text></xsl:when>
-  <xsl:otherwise><xsl:text>&#x25B6;&#x00A0;&#x00A0;</xsl:text></xsl:otherwise>
-  </xsl:choose><xsl:text>';
-  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
-}
-a.navbar-next::after {
-  <!-- FIXME: rtl -->
-  content: '</xsl:text><xsl:choose>
-  <xsl:when test="$left = 'left'"><xsl:text>&#x00A0;&#x00A0;&#x25B6;</xsl:text></xsl:when>
-  <xsl:otherwise><xsl:text>&#x00A0;&#x00A0;&#x25C0;</xsl:text></xsl:otherwise>
-  </xsl:choose><xsl:text>';
-  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
-}
-
 div.sidenav {
   padding: 0.5em 1em 0 1em;
   background-color: </xsl:text><xsl:value-of select="$theme.color.background"/><xsl:text>;
diff --git a/xslt/docbook/html/db2html-division.xsl b/xslt/docbook/html/db2html-division.xsl
index 646b99f..edfa193 100644
--- a/xslt/docbook/html/db2html-division.xsl
+++ b/xslt/docbook/html/db2html-division.xsl
@@ -45,6 +45,7 @@ REMARK: Describe this module
 </xsl:template>
 
 <xsl:template mode="html.body.mode" match="*">
+  <xsl:call-template name="db2html.links.next"/>
   <xsl:choose>
     <xsl:when test="self::db:info or self::bookinfo or self::articleinfo">
       <!-- FIXME
@@ -60,6 +61,8 @@ REMARK: Describe this module
       </xsl:apply-templates>
     </xsl:otherwise>
   </xsl:choose>
+  <xsl:call-template name="db2html.links.next"/>
+  <div class="clear"/>
 </xsl:template>
 
 <xsl:template mode="html.output.after.mode" match="*">
@@ -93,28 +96,6 @@ REMARK: Describe this module
 </xsl:template>
 
 
-<!--@@==========================================================================
-db2html.navbar.top
-Whether to place a navigation bar at the top of the page
-
-This boolean parameter specifies whether a block containing navigation
-links should be placed at the top of the page.  The top navigation bar
-is inserted by *{db2html.division.top}, so this parameter may have no
-effect if that template has been overridden.
--->
-<xsl:param name="db2html.navbar.top" select="true()"/>
-
-<!--@@==========================================================================
-db2html.navbar.bottom
-Whether to place a navigation bar at the bottom of the page
-
-This boolean parameter specifies whether a block containing navigation
-links should be placed at the bottom of the page.  The bottom navigation
-bar is inserted by *{db2html.division.bottom}, so this parameter may have
-no effect if that template has been overridden.
--->
-<xsl:param name="db2html.navbar.bottom" select="true()"/>
-
 <!--FIXME
 @@==========================================================================
 db2html.sidenav
@@ -185,9 +166,14 @@ REMARK: Talk about some of the parameters
   <div>
     <xsl:attribute name="class">
       <xsl:value-of select="local-name($node)"/>
-      <xsl:if test="$depth_in_chunk != 0">
-        <xsl:text> sect</xsl:text>
-      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="$depth_in_chunk = 0">
+          <xsl:text> contents</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text> sect</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:attribute>
     <xsl:choose>
       <xsl:when test="$dir = 'ltr' or $dir = 'rtl'">
@@ -401,7 +387,7 @@ REMARK: Describe this
 
 
 <!--**==========================================================================
-db2html.navbar
+db2html.links.next
 Generates navigation links for a page
 $node: The element to generate links for
 $prev_id: The id of the previous page
@@ -412,7 +398,7 @@ $position: Where the block is positioned on the pages, either 'top' or 'bottom'
 
 REMARK: Document this template
 -->
-<xsl:template name="db2html.navbar">
+<xsl:template name="db2html.links.next">
   <xsl:param name="node" select="."/>
   <xsl:param name="info" select="/false"/>
   <xsl:param name="depth_in_chunk">
@@ -452,68 +438,64 @@ REMARK: Document this template
   </xsl:param>
   <xsl:param name="prev_node" select="key('idkey', $prev_id)"/>
   <xsl:param name="next_node" select="key('idkey', $next_id)"/>
-  <div class="navbar">
-    <!-- FIXME: rtl -->
-    <table class="navbar"><tr>
-      <td class="navbar-prev">
-        <xsl:if test="$prev_id != ''">
-          <a class="navbar-prev">
-            <xsl:attribute name="href">
-              <xsl:call-template name="db.xref.target">
-                <xsl:with-param name="linkend" select="$prev_id"/>
-                <xsl:with-param name="target" select="$prev_node"/>
-                <xsl:with-param name="is_chunk" select="true()"/>
-              </xsl:call-template>
-            </xsl:attribute>
-            <xsl:choose>
-              <xsl:when test="$prev_id = $db.chunk.info_basename">
-                <xsl:variable name="text">
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'About This Document'"/>
-                  </xsl:call-template>
-                </xsl:variable>
-                <xsl:attribute name="title">
-                  <xsl:value-of select="$text"/>
-                </xsl:attribute>
-                <xsl:value-of select="$text"/>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:attribute name="title">
-                  <xsl:call-template name="db.xref.tooltip">
-                    <xsl:with-param name="linkend" select="$prev_id"/>
-                    <xsl:with-param name="target" select="$prev_node"/>
-                  </xsl:call-template>
-                </xsl:attribute>
-                <xsl:call-template name="db.titleabbrev">
-                  <xsl:with-param name="node" select="$prev_node"/>
-                </xsl:call-template>
-              </xsl:otherwise>
-            </xsl:choose>
-          </a>
-        </xsl:if>
-      </td>
-      <td class="navbar-next">
-        <xsl:if test="$next_id != ''">
-          <a class="navbar-next">
-            <xsl:attribute name="href">
-              <xsl:call-template name="db.xref.target">
-                <xsl:with-param name="linkend" select="$next_id"/>
-                <xsl:with-param name="is_chunk" select="true()"/>
+  <div class="links nextlinks">
+    <xsl:if test="$prev_id != ''">
+      <a class="nextlinks-prev">
+        <xsl:attribute name="href">
+          <xsl:call-template name="db.xref.target">
+            <xsl:with-param name="linkend" select="$prev_id"/>
+            <xsl:with-param name="target" select="$prev_node"/>
+            <xsl:with-param name="is_chunk" select="true()"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:choose>
+          <xsl:when test="$prev_id = $db.chunk.info_basename">
+            <xsl:variable name="text">
+              <xsl:call-template name="l10n.gettext">
+                <xsl:with-param name="msgid" select="'About This Document'"/>
               </xsl:call-template>
+            </xsl:variable>
+            <xsl:attribute name="title">
+              <xsl:value-of select="$text"/>
             </xsl:attribute>
+            <xsl:value-of select="$text"/>
+          </xsl:when>
+          <xsl:otherwise>
             <xsl:attribute name="title">
               <xsl:call-template name="db.xref.tooltip">
-                <xsl:with-param name="linkend" select="$next_id"/>
-                <xsl:with-param name="target"  select="$next_node"/>
+                <xsl:with-param name="linkend" select="$prev_id"/>
+                <xsl:with-param name="target" select="$prev_node"/>
               </xsl:call-template>
             </xsl:attribute>
-            <xsl:call-template name="db.titleabbrev">
-              <xsl:with-param name="node" select="$next_node"/>
+            <xsl:call-template name="l10n.gettext">
+              <xsl:with-param name="msgid" select="'Previous'"/>
             </xsl:call-template>
-          </a>
-        </xsl:if>
-      </td>
-    </tr></table>
+          </xsl:otherwise>
+        </xsl:choose>
+      </a>
+    </xsl:if>
+    <xsl:if test="$prev_id != '' and $next_id != ''">
+      <xsl:text>&#x00A0;&#x00A0;|&#x00A0;&#x00A0;</xsl:text>
+    </xsl:if>
+    <xsl:if test="$next_id != ''">
+      <a class="nextlinks-next">
+        <xsl:attribute name="href">
+          <xsl:call-template name="db.xref.target">
+            <xsl:with-param name="linkend" select="$next_id"/>
+            <xsl:with-param name="is_chunk" select="true()"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:call-template name="db.xref.tooltip">
+            <xsl:with-param name="linkend" select="$next_id"/>
+            <xsl:with-param name="target"  select="$next_node"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:call-template name="l10n.gettext">
+          <xsl:with-param name="msgid" select="'Next'"/>
+        </xsl:call-template>
+      </a>
+    </xsl:if>
   </div>
 </xsl:template>
 
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 5417ef1..ed33a78 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -319,8 +319,9 @@ REMARK: Describe this template
   </xsl:for-each>
 </xsl:template>
 
-<xsl:template name="mal2html.page.prevnextlinks">
-  <xsl:param name="node" select="."/>
+<!-- links -->
+<xsl:template name="mal2html.links.next" match="e:links[ type = 'next']">
+  <xsl:param name="node" select="./self::e:links/.. | ./self::mal:page"/>
   <xsl:variable name="linkid">
     <xsl:call-template name="mal.link.linkid">
       <xsl:with-param name="node" select="$node"/>
@@ -331,15 +332,21 @@ REMARK: Describe this template
     <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
     <xsl:if test="$prev or $next">
       <!-- FIXME: Get prev/next links in constant position -->
-      <div class="navbar">
+      <div class="links nextlinks">
         <xsl:if test="$prev">
-          <a class="navbar-prev">
+          <a class="nextlinks-prev">
             <xsl:attribute name="href">
               <xsl:call-template name="mal.link.target">
                 <xsl:with-param name="node" select="$prev"/>
                 <xsl:with-param name="xref" select="$prev/../../@id"/>
               </xsl:call-template>
             </xsl:attribute>
+            <xsl:attribute name="title">
+              <xsl:call-template name="mal.link.content">
+                <xsl:with-param name="node" select="$prev"/>
+                <xsl:with-param name="xref" select="$prev/@xref"/>
+              </xsl:call-template>
+            </xsl:attribute>
             <xsl:call-template name="l10n.gettext">
               <xsl:with-param name="msgid" select="'Previous'"/>
             </xsl:call-template>
@@ -349,13 +356,19 @@ REMARK: Describe this template
           <xsl:text>&#x00A0;&#x00A0;|&#x00A0;&#x00A0;</xsl:text>
         </xsl:if>
         <xsl:if test="$next">
-          <a class="navbar-next">
+          <a class="nextlinks-next">
             <xsl:attribute name="href">
               <xsl:call-template name="mal.link.target">
                 <xsl:with-param name="node" select="$next"/>
                 <xsl:with-param name="xref" select="$next/@xref"/>
               </xsl:call-template>
             </xsl:attribute>
+            <xsl:attribute name="title">
+              <xsl:call-template name="mal.link.content">
+                <xsl:with-param name="node" select="$next"/>
+                <xsl:with-param name="xref" select="$next/@xref"/>
+              </xsl:call-template>
+            </xsl:attribute>
             <xsl:call-template name="l10n.gettext">
               <xsl:with-param name="msgid" select="'Next'"/>
             </xsl:call-template>
@@ -501,8 +514,17 @@ REMARK: Describe this template
 </xsl:template>
 
 <xsl:template mode="html.body.mode" match="mal:page">
-  <xsl:call-template name="mal2html.page.prevnextlinks"/>
   <xsl:call-template name="mal2html.editor.banner"/>
+  <xsl:choose>
+    <xsl:when test="not(e:links[ type = 'next'])">
+      <xsl:call-template name="mal2html.links.next"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates
+          select="e:links[ type = 'next'][contains(concat(' ', @style, ' '), ' top ')]">
+      </xsl:apply-templates>
+    </xsl:otherwise>
+  </xsl:choose>
   <xsl:apply-templates select="."/>
 </xsl:template>
 
@@ -558,6 +580,11 @@ REMARK: Describe this template
             </xsl:apply-templates>
           </xsl:if>
         </xsl:when>
+        <xsl:when test="self::e:links[ type = 'next']">
+          <xsl:if test="not(contains(concat(' ', @style, ' '), ' top '))">
+            <xsl:apply-templates select="."/>
+          </xsl:if>
+        </xsl:when>
         <xsl:when test="self::e:links">
           <xsl:apply-templates select="."/>
         </xsl:when>
@@ -766,24 +793,6 @@ div.floatright {
   margin-left: 1em;
 }
 
-div.navbar {
-  margin: 0;
-  float: right;
-}
-a.navbar-prev::before {
-  content: '</xsl:text><xsl:choose>
-  <xsl:when test="$left = 'left'"><xsl:text>&#x25C0;&#x00A0;&#x00A0;</xsl:text></xsl:when>
-  <xsl:otherwise><xsl:text>&#x25B6;&#x00A0;&#x00A0;</xsl:text></xsl:otherwise>
-  </xsl:choose><xsl:text>';
-  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
-}
-a.navbar-next::after {
-  content: '</xsl:text><xsl:choose>
-  <xsl:when test="$left = 'left'"><xsl:text>&#x00A0;&#x00A0;&#x25B6;</xsl:text></xsl:when>
-  <xsl:otherwise><xsl:text>&#x00A0;&#x00A0;&#x25C0;</xsl:text></xsl:otherwise>
-  </xsl:choose><xsl:text>';
-  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
-}
 div.copyrights {
   text-align: center;
   color: </xsl:text>



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