开发者

is there a simple example of a php snippet highlighted in docbook with pdf output?

开发者 https://www.devze.com 2023-03-21 10:52 出处:网络
I\'ve been trying to highlight the code in a programlisting block in docbook. The code is the following:

I've been trying to highlight the code in a programlisting block in docbook. The code is the following:

<programlisting language="php"><![CDATA[ 
// php code
]]></programlisting>

Is there a simple example of how can this be outputted to pdf with php syntax highlighting?

If it helps in anyway i'm using xsltpoc (Using libxml 20708, libxslt 101开发者_如何学编程26 and libexslt 815) to generate fop files and fop (apache) to generate the pdf. The OS is Ubuntu

Thanks!!


I am not aware of any syntax highlighting solution for DocBook that can be used with xsltproc.

Here are two options that you might want to check out:

  • The DocBook XSL stylesheets support the XSLTHL syntax highlighter. It works with PHP and many other languages. XSLTHL is written in Java and requires either Xalan or Saxon. For details, see this reference.

  • This article explains how Pygments (syntax highlighter written in Python) can be used when processing documents with the DocBook XSL stylesheets.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号