diff options
Improved automatic source code highlighting
* disable indentation in both the page and datasource master stylesheets
** indentation was interfering with correct output of formatted code
* simplified call to formatter helper template
Diffstat (limited to 'source')
-rw-r--r-- | source/02_data/articles.xsl | 32 | ||||
-rw-r--r-- | source/99_result/article/article.xsl | 2 |
2 files changed, 15 insertions, 19 deletions
diff --git a/source/02_data/articles.xsl b/source/02_data/articles.xsl index bbe6f40..b3ac0df 100644 --- a/source/02_data/articles.xsl +++ b/source/02_data/articles.xsl @@ -15,6 +15,19 @@ <target mode="plain" value="articles.xml"/> </xsl:variable> +<xsl:template match="@*|node()" mode="embellish"> + <xsl:copy> + <xsl:apply-templates select="@*|node()" mode="embellish"/> + </xsl:copy> +</xsl:template> + +<xsl:template match="pre" mode="embellish"> + <xsl:call-template name="formatter"> + <xsl:with-param name="format">/usr/bin/highlight.sh</xsl:with-param> + <xsl:with-param name="source" select="code/text()"/> + </xsl:call-template> +</xsl:template> + <xsl:template name="list_tags"> <xsl:param name="path"/> @@ -29,23 +42,6 @@ </xsl:apply-templates> </xsl:template> -<xsl:template match="@*|node()" mode="content_transform"> - <xsl:copy> - <xsl:apply-templates select="@*|node()" mode="content_transform"/> - </xsl:copy> -</xsl:template> - -<xsl:template match="pre/code" mode="content_transform"> - <xsl:variable name="formatted_code"> - <xsl:call-template name="formatter"> - <xsl:with-param name="format">/usr/bin/highlight.sh</xsl:with-param> - <xsl:with-param name="source" select="text()"/> - </xsl:call-template> - </xsl:variable> - - <xsl:copy-of select="xalan:nodeset($formatted_code)/pre/node()"/> -</xsl:template> - <xsl:template match="files/articles/file[./extension = '.md']"> <xsl:variable name="content"> <xsl:call-template name="formatter"> @@ -72,7 +68,7 @@ </xsl:call-template> </tags> <content> - <xsl:apply-templates mode="content_transform" select="xalan:nodeset($content)/*[name() != 'h1']"/> + <xsl:apply-templates select="xalan:nodeset($content)/*[name() != 'h1']" mode="embellish"/> </content> </entry> </xsl:template> diff --git a/source/99_result/article/article.xsl b/source/99_result/article/article.xsl index a82dcb1..bd7ed14 100644 --- a/source/99_result/article/article.xsl +++ b/source/99_result/article/article.xsl @@ -34,7 +34,7 @@ </xsl:for-each> | Adrian Kummerländer </p> - <xsl:copy-of select="content/*"/> + <xsl:copy-of select="content/node()"/> </div> </xsl:template> |