<xsl:call-template name='glue-preceding-span' />
<xsl:copy>
<xsl:apply-templates select='node()|@*' />
- <xsl:text>⁠</xsl:text> <!-- avoid breaking within a span element -->
+ <xsl:if test='*'>
+ <!-- avoid breaking within a span element -->
+ <xsl:text>⁠</xsl:text>
+ </xsl:if>
</xsl:copy>
</xsl:template>
</xsl:when>
<!-- preserve anything under <pre> -->
<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>
</xsl:choose>
</xsl:template>
+<!-- Clean up whitespace where harmless to do so -->
+<xsl:template match='xhtml:p/node()[1][self::text()]'>
+ <xsl:value-of select='f:strip-leading()' />
+</xsl:template>
+<xsl:template match='xhtml:p/node()[position()=last()][self::text()]'>
+ <xsl:value-of select='f:strip-trailing()' />
+</xsl:template>
+
<!-- Add rel attributes to external links -->
<xsl:template match='xhtml:a[starts-with(@href,"http://")
or starts-with(@href,"https://")
<head>
<meta name='viewport' content='width=device-width, initial-scale=1' />
<link rel='stylesheet' type='text/css' href='/style.css' />
+ <link rel="icon" href="data:," />
<title>
<xsl:variable name='page-title' select='string(/document/title)' />
<xsl:if test='$page-title and $site-title != $page-title'>