diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2018-10-07 13:42:09 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2018-10-07 13:42:09 +0200 |
| commit | 1105322aac9cc8e71eafbf5a5eea8e709c8c77ce (patch) | |
| tree | bb2026db2adb7e1b7ab7396a047f64bbc17d0210 /templates | |
| parent | 076545376eb1ce47de2135373fb858db5a411e8c (diff) | |
| download | grauphel-1105322aac9cc8e71eafbf5a5eea8e709c8c77ce.tar.gz grauphel-1105322aac9cc8e71eafbf5a5eea8e709c8c77ce.zip | |
Display tab-based line indentation in HTML
Resolves: https://github.com/cweiske/grauphel/issues/60
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/html2tomboy.xsl | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/templates/html2tomboy.xsl b/templates/html2tomboy.xsl index a354000..f3da05e 100644 --- a/templates/html2tomboy.xsl +++ b/templates/html2tomboy.xsl @@ -21,7 +21,11 @@ <xsl:for-each select="child::node()"> <xsl:choose> <xsl:when test="local-name(.) = ''"> - <xsl:value-of select="."/> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="string(.)" /> + <xsl:with-param name="replace" select="'        '" /> + <xsl:with-param name="by" select="'	'" /> + </xsl:call-template> </xsl:when> <xsl:when test="local-name(.) = 'br'"> <!-- do nothing --> @@ -90,4 +94,24 @@ </xsl:for-each> </xsl:template> + <!-- http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx --> + <xsl:template name="string-replace-all"> + <xsl:param name="text" /> + <xsl:param name="replace" /> + <xsl:param name="by" /> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text,$replace)" /> + <xsl:value-of select="$by" /> + <xsl:call-template name="string-replace-all"> + <xsl:with-param name="text" select="substring-after($text,$replace)" /> + <xsl:with-param name="replace" select="$replace" /> + <xsl:with-param name="by" select="$by" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> </xsl:stylesheet> |
