diff options
author | Tim Yamin <plasmaroo@gentoo.org> | 2006-03-09 20:09:28 +0000 |
---|---|---|
committer | Tim Yamin <plasmaroo@gentoo.org> | 2006-03-09 20:09:28 +0000 |
commit | cbb4c933a0323fcaa84262b69849fbf52ac2e336 (patch) | |
tree | 56dccd3f29e15894020cfe5c810656e9de4672f4 /devbook.xsl | |
parent | Fix code highlighting if we start with tabs rather than whitespace. (diff) | |
download | devmanual-cbb4c933a0323fcaa84262b69849fbf52ac2e336.tar.gz devmanual-cbb4c933a0323fcaa84262b69849fbf52ac2e336.tar.bz2 devmanual-cbb4c933a0323fcaa84262b69849fbf52ac2e336.zip |
Add optional line numbering to the syntax highlighter.
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/devmanual/trunk@23 176d3534-300d-0410-8db8-84e73ed771c3
Diffstat (limited to 'devbook.xsl')
-rw-r--r-- | devbook.xsl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/devbook.xsl b/devbook.xsl index c2251ae..dafc746 100644 --- a/devbook.xsl +++ b/devbook.xsl @@ -90,8 +90,7 @@ <xsl:call-template name="highlight-subtokenate"> <xsl:with-param name="data" select="substring-before(substring-after($data, '--'), ')')"/> </xsl:call-template> - </span> - )<xsl:value-of select="substring-after(substring-after($data, '--'), ')')"/> + </span>)<xsl:value-of select="substring-after(substring-after($data, '--'), ')')"/> </xsl:when> <xsl:otherwise> <span class="Comment"> @@ -520,10 +519,15 @@ <!-- FIXME: Handle lang=... --> <xsl:template match="codesample"> <pre><span class="Constant"> + <xsl:variable name="numbering" select="@numbering"/> <xsl:for-each select="str:tokenize_plasmaroo(., $newline)"> <xsl:choose> - <xsl:when test=". = $newline and position() = 1"/> - <xsl:when test=". = $newline"><xsl:value-of select='$newline'/></xsl:when> + <xsl:when test=". = $newline"> + <xsl:if test="position() != 1"><xsl:value-of select='$newline'/></xsl:if> + <xsl:if test="$numbering = 'lines' and position() != last()-1"> + <span style="float: left;"><xsl:number format="01"/>:<xsl:text> </xsl:text></span> + </xsl:if> + </xsl:when> <xsl:otherwise> <!-- <xsl:if test="position() != 1"><xsl:value-of select='$newline'/></xsl:if> --> <xsl:call-template name="highlight-tokenate"> |