diff options
Added basic article content embellishment
* i.e. inline code is automatically highlighted using an external syntax highligher
-rw-r--r-- | source/02_data/articles.xsl | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/02_data/articles.xsl b/source/02_data/articles.xsl index 6401b64..bbe6f40 100644 --- a/source/02_data/articles.xsl +++ b/source/02_data/articles.xsl @@ -29,6 +29,23 @@ </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"> @@ -55,7 +72,7 @@ </xsl:call-template> </tags> <content> - <xsl:copy-of select="xalan:nodeset($content)/*[name() != 'h1']"/> + <xsl:apply-templates mode="content_transform" select="xalan:nodeset($content)/*[name() != 'h1']"/> </content> </entry> </xsl:template> |