[yelp-xsl/wip/html5] Keep previous links in a stable location



commit e2f4adaf9f9fc89f08024fe3426fa8084db8e06e
Author: Shaun McCance <shaunm gnome org>
Date:   Wed Feb 3 12:14:35 2016 -0500

    Keep previous links in a stable location

 xslt/common/html.xsl                 |   14 ++++++++------
 xslt/dita/html/dita2html-topic.xsl   |   13 +++++++++++--
 xslt/docbook/html/db2html-links.xsl  |   13 +++++++++++--
 xslt/mallard/html/mal2html-links.xsl |   16 +++++++++++++---
 4 files changed, 43 insertions(+), 13 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 41c1abd..6345d37 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -1072,7 +1072,7 @@ div.sectionlinks div.sectionlinks li {
 nav.prevnext { clear: both; }
 div.region > nav.prevnext, div.region + nav.prevnext { margin-top: 1em; }
 nav.prevnext > div.inner { float: </xsl:text><xsl:value-of select="$right"/><xsl:text>; }
-nav.prevnext a {
+nav.prevnext > div.inner > * {
   background-color: </xsl:text><xsl:value-of select="$color.bg.gray"/><xsl:text>;
   display: inline-block;
   position: relative;
@@ -1081,12 +1081,15 @@ nav.prevnext a {
   margin-bottom: 1em;
   border: solid 1px </xsl:text><xsl:value-of select="$color.gray"/><xsl:text>;
 }
-nav.prevnext a + a { border-</xsl:text><xsl:value-of select="$left"/><xsl:text>: none; }
-nav.prevnext a:first-child {
+nav.prevnext > div.inner > span { visibility: hidden; }
+nav.prevnext > div.inner > a + a {
+  border-</xsl:text><xsl:value-of select="$left"/><xsl:text>: none;
+}
+nav.prevnext > div.inner > a:first-child {
   border-top-</xsl:text><xsl:value-of select="$left"/><xsl:text>-radius: 2px;
   border-bottom-</xsl:text><xsl:value-of select="$left"/><xsl:text>-radius: 2px;
 }
-nav.prevnext a:last-child {
+nav.prevnext > div.inner > a:last-of-type {
   border-top-</xsl:text><xsl:value-of select="$right"/><xsl:text>-radius: 2px;
   border-bottom-</xsl:text><xsl:value-of select="$right"/><xsl:text>-radius: 2px;
 }
@@ -2458,7 +2461,6 @@ This mode is called by *{html.syntax.class} on source elements that may have
 syntax highlighted. This template should be implemented by importing stylesheets.
 It should return a simple language identifier.
 -->
-<xsl:template mode="html.syntax.class.mode" select="*"/>
-
+<xsl:template mode="html.syntax.class.mode" match="*"/>
 
 </xsl:stylesheet>
diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl
index 7c248ae..e9e5b93 100644
--- a/xslt/dita/html/dita2html-topic.xsl
+++ b/xslt/dita/html/dita2html-topic.xsl
@@ -103,7 +103,8 @@ REMARK: Describe this module
         </xsl:call-template>
       </a>
     </xsl:if>
-    <xsl:if test="$next">
+    <xsl:choose>
+    <xsl:when test="$next">
       <a>
         <xsl:attribute name="href">
           <xsl:for-each select="str:split($node/@href, '/')">
@@ -124,7 +125,15 @@ REMARK: Describe this module
           <xsl:with-param name="msgid" select="'Next'"/>
         </xsl:call-template>
       </a>
-    </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+      <span>
+        <xsl:call-template name="l10n.gettext">
+          <xsl:with-param name="msgid" select="'Next'"/>
+        </xsl:call-template>
+      </span>
+    </xsl:otherwise>
+    </xsl:choose>
   </div></nav>
 </xsl:template>
 
diff --git a/xslt/docbook/html/db2html-links.xsl b/xslt/docbook/html/db2html-links.xsl
index ff3a517..f129e87 100644
--- a/xslt/docbook/html/db2html-links.xsl
+++ b/xslt/docbook/html/db2html-links.xsl
@@ -156,7 +156,8 @@ and "Next", although the actual page titles are used for tooltips.
         </xsl:call-template>
       </a>
     </xsl:if>
-    <xsl:if test="$next_id != ''">
+    <xsl:choose>
+    <xsl:when test="$next_id != ''">
       <a>
         <xsl:attribute name="href">
           <xsl:call-template name="db.xref.target">
@@ -174,7 +175,15 @@ and "Next", although the actual page titles are used for tooltips.
           <xsl:with-param name="msgid" select="'Next'"/>
         </xsl:call-template>
       </a>
-    </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+      <span>
+        <xsl:call-template name="l10n.gettext">
+          <xsl:with-param name="msgid" select="'Next'"/>
+        </xsl:call-template>
+      </span>
+    </xsl:otherwise>
+    </xsl:choose>
   </div></nav>
 </xsl:template>
 
diff --git a/xslt/mallard/html/mal2html-links.xsl b/xslt/mallard/html/mal2html-links.xsl
index 906533b..b28bdb1 100644
--- a/xslt/mallard/html/mal2html-links.xsl
+++ b/xslt/mallard/html/mal2html-links.xsl
@@ -431,7 +431,6 @@ calling functions in !{mal2html-page}.
   <xsl:for-each select="$mal.cache">
     <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 -->
       <nav class="prevnext"><div class="inner">
         <xsl:if test="$prev">
           <a>
@@ -454,7 +453,8 @@ calling functions in !{mal2html-page}.
             </xsl:for-each>
           </a>
         </xsl:if>
-        <xsl:if test="$next">
+        <xsl:choose>
+        <xsl:when test="$next">
           <a>
             <xsl:attribute name="href">
               <xsl:call-template name="mal.link.target">
@@ -474,7 +474,17 @@ calling functions in !{mal2html-page}.
               </xsl:call-template>
             </xsl:for-each>
           </a>
-        </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <span>
+            <xsl:for-each select="$page">
+              <xsl:call-template name="l10n.gettext">
+                <xsl:with-param name="msgid" select="'Next'"/>
+              </xsl:call-template>
+            </xsl:for-each>
+          </span>
+        </xsl:otherwise>
+        </xsl:choose>
       </div></nav>
     </xsl:if>
   </xsl:for-each>


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