aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-08-06 23:49:20 +0200
committerAdrian Kummerlaender2014-08-06 23:49:20 +0200
commit4ba35f4999514043d2ff420779cb07cedb8b0d96 (patch)
tree1310c032fc24df6d80d164db95205fde5c6d4f38 /source
parent96895b711b282e914d064273ef9f74b2c5f0c920 (diff)
downloadblog.kummerlaender.eu-4ba35f4999514043d2ff420779cb07cedb8b0d96.tar
blog.kummerlaender.eu-4ba35f4999514043d2ff420779cb07cedb8b0d96.tar.gz
blog.kummerlaender.eu-4ba35f4999514043d2ff420779cb07cedb8b0d96.tar.bz2
blog.kummerlaender.eu-4ba35f4999514043d2ff420779cb07cedb8b0d96.tar.lz
blog.kummerlaender.eu-4ba35f4999514043d2ff420779cb07cedb8b0d96.tar.xz
blog.kummerlaender.eu-4ba35f4999514043d2ff420779cb07cedb8b0d96.tar.zst
blog.kummerlaender.eu-4ba35f4999514043d2ff420779cb07cedb8b0d96.zip
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.xsl32
-rw-r--r--source/99_result/article/article.xsl2
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>