]> git.draconx.ca Git - homepage.git/blobdiff - layouts/default.xsl
Adjust whitespace preservation rules.
[homepage.git] / layouts / default.xsl
index 29455705797de7914f22e4e8b764af022485003a..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>