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] syntax highlighting with xslt2/pygments/jython/saxon


OK, thanks a lot.

While your explanations are certainly very precise and I understand
a lot better now, what's going on and how it is supposed to work,
it is still not working for me (for html). - Will try to reduce
my example document to the absolute minimum / dig further.

-Andreas


"Mauritz Jeanson" <mj@johanneberg.com> writes:

> |  -----Original Message-----
> |  From: Andreas Reuleaux
>   
> |  java \
> |  -cp 
> |
> "/opt/saxonhe/saxon9he.jar:/opt/dbk/xslt2/lib/docbook-xsl2-saxon.jar:/usr/sh
> are/java/jython.jar" net.sf.saxon.Transform \
> |  -init:docbook.Initializer \
> |  -s:myfile.dbk \
> |  -xsl:fo-xslt2.xsl \
> |  -o:myfile.fo \
> |  -xi:on \
> |  -ext:on \
> |  use.extensions=1 \
> |  fop1.extensions=1
> |   
> |    OK, my toolchain still works, but no highlighting yet
>
>
> At present, highlighting does not work for XSL-FO. There are two reasons as
> far as I can tell:
> 1. The code for calling Pygments via Jython only handles (X)HTML output. 
> 2. Pygments does not provide an XSL-FO formatter.
>
> For XHTML, it took me a while to figure out how to make highlighting work
> (Saxon HE on Windows XP). These points were particularly important:
>
> 1. Add role="pygments" to the <programlisting> element in the source XML.
>
> 2. Add 
>
>  -Dpython.path=<path to Pygments install dir>
>
> to the "java" command. This was necessary in order to avoid "ImportError: No
> module named pygments".
>
> 3. Add the output generated from this snippet,
>
>  from pygments.formatters import HtmlFormatter
>  print HtmlFormatter().get_style_defs()
>
> to a CSS file, and ensure that this file is referenced in the output (see
> the docbook.css parameter).
>
> Below is the contents of my Windows BAT file. I run it from the root
> directory of the 2.0.2 relase downloaded from http://docbook.github.com/.
>
> ----------
> java
> -Dpython.path=c:/Java/jython2.5.2/Lib/site-packages/Pygments-1.4-py2.5.egg ^
>     -cp
> c:/Java/saxon93/saxon9he.jar;./lib/docbook-xsl2-saxon.jar;c:/Java/jython2.5.
> 2/jython.jar ^
>     net.sf.saxon.Transform ^
>     -init:docbook.Initializer ^
>     -s:verbatim.xml ^
>     -xsl:./xslt/base/html/docbook.xsl ^
>     -o:verbatim.html ^
>     -xi:on ^
>     -ext:on ^
>     docbook.css=mydefault.css
> ----------
>
>
> |  * Also there is mention of some python.path setting in ~/.jython 
> |    what does that look exactely (the path to the script maybe)?
>
>
> As an alternative to '-Dpython.path=...' at the command line, you can add 
>
>  python.path=<path to Pygments install dir>
>
> to ~/.jython.
>
> See http://wiki.python.org/jython/UserGuide#the-jython-registry
>
>  
> |  * I use neither Saxon PE or EE, but saxonb and/or saxonhe
> |    so I guess I don't have to set 
> |  
> |     <resources>
> |      
> |  <extensionFunction>org.docbook.extensions.xslt20.Cwd</extensi
> onFunction>
> |      
> |  <extensionFunction>org.docbook.extensions.xslt20.ImageIntrins
> ics</extensionFunction>
> |      
> |  <extensionFunction>org.docbook.extensions.xslt20.Pygmenter</e
> xtensionFunction>
> |    </resources>
>
>
> That's right, configuration files cannot be used with Saxon HE. See
> http://www.saxonica.com/documentation/configuration/configuration-file.xml.
>
> Mauritz
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
>
> !DSPAM:4eb1dcae66961388319417!


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