]> git.draconx.ca Git - homepage.git/blobdiff - layouts/default.xsl
Adjust whitespace preservation rules.
[homepage.git] / layouts / default.xsl
index bfe9101a6bb4c55444dd5171d5b39366f566220a..eaeef724f3411cb14ea63a5b6e7593d8fefc0423 100644 (file)
@@ -35,6 +35,7 @@
 <xsl:param name='source-uri'
   select='"//git.draconx.ca/gitweb/homepage.git/blob/"' />
 <xsl:param name='site-title' select='"The Citrine Citadel"' />
+<xsl:param name='section-links' select='//document/section-links' />
 
 <func:function name='f:ends-with'>
   <xsl:param name='a' />
     <xsl:when test='ancestor::xhtml:pre'><xsl:copy /></xsl:when>
     <!-- preserve whitespace which is the only child node of an element -->
     <xsl:when test='count(../node()) = 1'><xsl:copy /></xsl:when>
+    <!-- preserve whitespace between consecutive span-level elements
+         which have at least one non-whitespace sibling text element -->
+    <xsl:when test='f:element-is-span(preceding-sibling::node()[1])
+                    and f:element-is-span(following-sibling::node()[1])
+                    and ../text()[normalize-space(.) != ""]'>
+      <xsl:copy />
+    </xsl:when>
   </xsl:choose>
 </xsl:template>
 
   <xsl:variable name='fragment' select='concat("#", @id)' />
   <xsl:copy>
     <xsl:apply-templates select='node()|@*' />
-    <xsl:text> </xsl:text>
-    <small class='permalink'>
-      (<a href='{$fragment}'><xsl:value-of select='$fragment' /></a>)
-    </small>
+    <xsl:if test='$section-links = "yes"'>
+      <xsl:text> </xsl:text>
+      <small class='permalink'>
+        (<a href='{$fragment}'><xsl:value-of select='$fragment' /></a>)
+      </small>
+    </xsl:if>
   </xsl:copy>
 </xsl:template>
 
     </head>
     <body>
       <xsl:apply-templates select='/document/xhtml:html/@*' />
+
+      <xsl:if test='/document/hierarchy/parent'>
+        <p id='sitetitle'>
+          <small><xsl:value-of select='$site-title' /></small>
+        </p>
+        <div id='breadcrumbs'>
+          <strong>Return to: </strong>
+          <ul>
+            <xsl:for-each select='/document/hierarchy/parent'>
+              <li><a href='{uri}'><xsl:value-of select='name'/></a></li>
+            </xsl:for-each>
+          </ul>
+        </div>
+        <hr />
+      </xsl:if>
+
       <xsl:apply-templates select='/document/xhtml:html/node()' />
 
       <hr />