OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Different Colors for Different Programming Languages (Syntax Highlighting)?


On 21.3.2013 8:30, Thomas Schraitle wrote:

> How can I do that? Is there a recommended procedure?

I'm not sure whether this is the easiest solution but you can override
template apply-highlighting from highlighting/common.xsl in a way that
for each language special mode will be invoked instead of just
mode="xslthl", e.g.

 <xsl:when test="function-available('s6hl:highlight') and $language =
'java'">
   <xsl:apply-templates select="s6hl:highlight($language,
exsl:node-set($content), $highlight.xslthl.config)"
	   mode="xslthl-java"/>
 </xsl:when>

 <xsl:when test="function-available('s6hl:highlight') and $language =
'cpp'">
   <xsl:apply-templates select="s6hl:highlight($language,
exsl:node-set($content), $highlight.xslthl.config)"
	   mode="xslthl-cpp"/>
 </xsl:when>

Then you need to copy all templates with mode="xslthl" and change mode
to xslthl-java and xslthl-cpp and make appropriate changes.

For future we might pass optional parameter called language to all
templates in xslthl mode in order to for language in template for each
kind of keyword. If you think this will work better for your scenario,
please fill RFE.

				Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@kosek.cz      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
------------------------------------------------------------------
    Bringing you XML Prague conference    http://xmlprague.cz
------------------------------------------------------------------

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]