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] Color In Syntax Highlighting


That makes beautiful source code! Thank you!
 
----- Original Message -----
From: Radu Coravu <radu_coravu@sync.ro>
To: docbook-apps@lists.oasis-open.org
Sent: Mon, 20 Feb 2017 07:25:59 -0000 (UTC)
Subject: Re: [docbook-apps] Color In Syntax Highlighting
Hi,
There is a "highlight.xsl" specific for the XSL-FO PDF publishing which
matches various syntax highlight range elements and adds bold or italic
styling to them like:
> <xsl:template match='xslthl:value' mode="xslthl">
> <fo:inline font-weight="bold"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
For example we have replaced the default PDF styling templates for our
Oxygen XML user's manual with templates applying color styling:
> <!-- Color syntax highlight-->
> <xsl:template match='xslthl:keyword' mode="xslthl">
> <fo:inline font-weight="bold" color="#7f0055"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <xsl:template match='xslthl:string' mode="xslthl">
> <fo:inline font-weight="bold" font-style="italic" color="#2a00ff"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <xsl:template match='xslthl:comment' mode="xslthl">
> <fo:inline font-style="italic" color="#006400"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <xsl:template match='xslthl:tag' mode="xslthl">
> <fo:inline font-weight="bold" color="#000096"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
> <xsl:template match='xslthl:xslt' mode="xslthl">
> <fo:inline font-weight="bold" color="#0092E6"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
> <xsl:template match='xslthl:attribute' mode="xslthl">
> <fo:inline font-weight="bold" color="#ff7935"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <xsl:template match='xslthl:value' mode="xslthl">
> <fo:inline font-weight="bold" color="#993300" ><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <xsl:template match='xslthl:number' mode="xslthl">
> <xsl:apply-templates mode="xslthl"/>
> </xsl:template>
>
> <xsl:template match='xslthl:annotation' mode="xslthl">
> <fo:inline color="gray"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <xsl:template match='xslthl:directive' mode="xslthl">
> <fo:inline color="#8b26c9"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <!-- Not sure which element will be in final XSLTHL 2.0 -->
> <xsl:template match='xslthl:doccomment' mode="xslthl">
> <fo:inline font-weight="bold" color="#3f5fbf"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
>
> <xsl:template match='xslthl:doctype' mode="xslthl">
> <fo:inline font-weight="bold" color="#0000ff"><xsl:apply-templates mode="xslthl"/></fo:inline>
> </xsl:template>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
On 2/20/2017 1:42 AM, stimits@comcast.net wrote:
> Hi,
>
> Thanks everyone for your patience with my previous questions on fonts
> and getting Saxon to work with syntax highlighting. I managed to get all
> of my changes into a set of customization files and make sure my actual
> DocBook and fop installations are stock. So now I'm looking closer at
> being able to use DocBook to describe source code.
>
> Right now the highlighting is xslthl-2.1.3, and DocBook is
> docbook-xsl-ns-1.79.1. Line numbering occurs, and syntax highlighting
> works, but it is limited to bold, italic, or normal text...there is no
> color involved. I see many PDF or web pages which have beautiful
> colorized syntax highlighting produced via DocBook (or fop I guess I
> should say). Is there some additional downloads for including color and
> not just grayscale? Or perhaps there is a config file to enable color
> (xslthl-config.xml and related files don't seem to mention color anywhere)?
>
> Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


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