[vala/wip/manual] manual: Add navigation links to top bar



commit 58fccd525d80b4006f23c320ec776cfd3a78e8e9
Author: Alistair Thomas <astavale yahoo co uk>
Date:   Wed Mar 8 21:01:41 2017 +0000

    manual: Add navigation links to top bar

 doc/manual/default.css |   41 ++++++++++++++++++++++++++++++++++++-----
 doc/manual/xhtml.xsl   |   43 +++++++++++++++++++++++++++++++++++++++----
 2 files changed, 75 insertions(+), 9 deletions(-)
---
diff --git a/doc/manual/default.css b/doc/manual/default.css
index 93d3ee3..f118ad5 100644
--- a/doc/manual/default.css
+++ b/doc/manual/default.css
@@ -67,19 +67,41 @@ h3 {
        padding-top: 1.4em;
 }
 
-.header {
-       background-color: #005a9c;
-       font-weight: bold;
-       padding: .35em;
+.o-fixedtop {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
+       overflow: hidden;
+}
+
+.o-inlinewidth-4 {
+       display: inline-block;
+       width: 4em;
+}
+
+.o-navbar {
+       padding: .35em;
        height: 1.4em;
+       max-width: 35em;
+}
+
+.c-navbar {
+       background-color: #005a9c;
+       color: white;
+       font-weight: bold;
+       text-align: center;
 }
 
-.header a {
+.c-pageturner a {
        color: white;
+       border-radius: 0.4em;
+       padding: 0 0.5em;
+}
+
+.c-pageturner a:hover {
+       color: #005a9c;
+       background-color: white;
 }
 
 div.note {
@@ -149,3 +171,12 @@ blockquote span.literal {
        font-size: 110%;
        padding-right: 0.5em;
 }
+
+.u-float-left {
+       float: left;
+       overflow: hidden;
+}
+.u-float-right {
+       float: right;
+       overflow: hidden;
+}
diff --git a/doc/manual/xhtml.xsl b/doc/manual/xhtml.xsl
index ca7f39b..4253090 100644
--- a/doc/manual/xhtml.xsl
+++ b/doc/manual/xhtml.xsl
@@ -51,7 +51,7 @@
         </head>
         <body>
           <xsl:apply-templates
-            select="/article/section/title"
+            select="title"
             mode="navigation-bar"
           />
           <xsl:apply-templates select="title" mode="heading"/>
@@ -100,12 +100,47 @@
     <xsl:apply-templates select="articleinfo|section"/>
   </xsl:template>
 
-  <xsl:template match="article/section/title" mode="navigation-bar">
-    <div class="header">
-      <a href="index.html"><xsl:value-of select="."/></a>
+  <xsl:template match="title" mode="navigation-bar">
+    <div class="o-fixedtop c-navbar">
+      <div class="o-navbar">
+      <span class="c-pageturner u-float-left"><a href="index.html">Contents</a></span>
+      <span><xsl:value-of select="/article/section/title"/></span>
+      <div class="u-float-right">
+      <span class="c-pageturner o-inlinewidth-4"><xsl:call-template name="navigation-bar-prev"/></span>
+      <span class="c-pageturner o-inlinewidth-4"><xsl:call-template name="navigation-bar-next"/></span>
+      </div>
+      </div>
     </div>
   </xsl:template>
 
+  <xsl:template name="navigation-bar-prev">
+    <xsl:choose>
+      <xsl:when test="parent::section/preceding::section[1]/title">
+        <xsl:call-template name="linkto">
+          <xsl:with-param name="title">Prev</xsl:with-param>
+          <xsl:with-param name="page" select="parent::section/preceding-sibling::section[1]/title"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="parent::section[1]/parent::section/title">
+        <a href="index.html">Prev</a>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="navigation-bar-next">
+    <xsl:choose>
+      <xsl:when 
test="parent::section/parent::article/section/section[1]/title|parent::section/following::section[1]/title">
+        <xsl:call-template name="linkto">
+          <xsl:with-param name="title">Next</xsl:with-param>
+          <xsl:with-param name="page" 
select="parent::section/parent::article/section/section[1]/title|parent::section/following::section[1]/title"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <span></span>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <xsl:template match="article/section" mode="toc">
       <h1><xsl:apply-templates select="title"/></h1>
       <xsl:apply-templates select="document('version.xml')/articleinfo" mode="toc"/>


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