docbook-apps

  • 1.  Colored listings

    Posted 04-12-2010 17:40
    Hello,

    I want to get colored listings in docbook output, how I can get it?
    Is there a simple way to make text colored, such tags

    <color color="dark_green">class</color> CMyClass { };

    or there is more specialized tags such

    <cpp-keyword>class</cpp-keyword> CMyClass { };

    or there is another way to make listings colored?

    Marty.





  • 2.  RE: [docbook-apps] Colored listings

    Posted 04-12-2010 17:57
    Marty,

    Bob Statyton has a good discussion of program listings:

    http://www.sagehill.net/docbookxsl/ProgramListings.html

    There is a section on syntax highlighting (which differentiates among things like keywords, constants, and parameters) at the bottom of the ToC on this page.

    Regards,
    Larry Rowland






  • 3.  Re: [docbook-apps] Colored listings

    Posted 04-13-2010 11:21
    Hello Larry,

    As I understand, there is no way to use syntax highlighting with
    xsltproc, it's requres Saxon. Next, Saxon itself does not process
    XInclude's, and I need to use xmllint to do this.

    Also, saxon need the F:\work\docbook-tools\docbook-xsl\fo\F:\work\docbook-tools\docbook-xsl\fo\param.xsl
    to be fixed on line 336 as below:


    So I try next:
    xmllint --xinclude dlc.xml >dlc_.xml
    call mkpdf.bat dlc_.xml

    ------ mkpdf.bat ---------
    java -cp "F:\work\docbook-tools\syntax-hl\xslthl-2.0.1.jar;F:\work\docbook-tools\syntax-hl\saxonhe9-2-0-6j\saxon9he.jar"^
    net.sf.saxon.Transform^
    -o:%~dpn2.fo^
    -s:%1^
    -xsl:%~dp0\..\docbook-xsl\fo\docbook.xsl^
    highlight.xslthl.config="file:///F:/work/docbook-tools/highlighting/xslthl-config.xml" ^
    use.extensions=1^
    textinsert.extension=1^
    highlight.source=1

    %~dp0\..\fop\fop.bat -c %~dp0\..\fop\conf\fop.xconf -fo %~dpn2.fo -pdf %2
    ----------------------------


    But listings are still black and white. I'm looking in generated .fo
    and found that there is no differences with xsltproc generated .fo.

    What I'm doing wrong?


    Monday, April 12, 2010, 9:56:56 PM, you wrote:

    RL> Marty,

    RL> Bob Statyton has a good discussion of program listings:

    RL> http://www.sagehill.net/docbookxsl/ProgramListings.html

    RL> There is a section on syntax highlighting (which differentiates
    RL> among things like keywords, constants, and parameters) at the bottom of the ToC on this page.

    RL> Regards,
    RL> Larry Rowland






  • 4.  Re: [docbook-apps] Colored listings

    Posted 04-13-2010 11:40
    2010/4/13 ????????? ???????? <amart@mail.ru>:
    > But listings are still black and white. I'm looking in generated .fo
    > and found that there is no differences with xsltproc generated .fo.

    Try HTML output. You'll see that Syntax Highlithing is working. PDF
    output by default will display shade or gray (AFAIK). You need even
    more toying to get actual 'color'.

    HTH
    --
    Mathieu



  • 5.  Re: [docbook-apps] Colored listings

    Posted 04-13-2010 12:01
    Hello Mathieu,

    I try to generate html using next bat file:

    --- mkhtml.bat ---
    java -cp "F:\work\docbook-tools\syntax-hl\xslthl-2.0.1.jar;F:\work\docbook-tools\syntax-hl\saxonhe9-2-0-6j\saxon9he.jar"^
    net.sf.saxon.Transform^
    -o:%2^
    -s:%1^
    -xsl:%~dp0\..\docbook-xsl\html\docbook.xsl^
    highlight.xslthl.config="file:///F:/work/docbook-tools/highlighting/xslthl-config.xml" ^
    use.extensions=1^
    textinsert.extension=1^
    highlight.source=1
    ------

    But code displayed B/W at the same. I was inspect generated html and not
    found any hints for coloring.


    Tuesday, April 13, 2010, 3:39:34 PM, you wrote:

    MM> 2010/4/13 ????????? ???????? <amart@mail.ru>:
    >> But listings are still black and white. I'm looking in generated .fo
    >> and found that there is no differences with xsltproc generated .fo.

    MM> Try HTML output. You'll see that Syntax Highlithing is working. PDF
    MM> output by default will display shade or gray (AFAIK). You need even
    MM> more toying to get actual 'color'.

    MM> HTH



    ________________________________________________
    ? ?????????, ???????? ????????? (Marty)

    mailto: amart@mail.ru
    web: http://marty.spb.ru




  • 6.  Re: [docbook-apps] Colored listings

    Posted 04-13-2010 12:02
    2010/4/13 ????????? ???????? <amart@mail.ru>:
    > Hello Mathieu,
    >
    > I try to generate html using next bat file:
    >
    > --- mkhtml.bat ---
    > java -cp "F:\work\docbook-tools\syntax-hl\xslthl-2.0.1.jar;F:\work\docbook-tools\syntax-hl\saxonhe9-2-0-6j\saxon9he.jar"^
    >  net.sf.saxon.Transform^
    >  -o:%2^
    >  -s:%1^
    >  -xsl:%~dp0\..\docbook-xsl\html\docbook.xsl^

    I am not using docbook-xsl/fo/docbook.xsl when doing highlithing.
    Instead I use: docbook-xsl/fo/highlight.xsl

    Ref:
    http://www.sagehill.net/docbookxsl/SyntaxHighlighting.html

    --
    Mathieu



  • 7.  Re: [docbook-apps] Colored listings

    Posted 04-14-2010 11:02
    Hello Mathieu,

    I have got an error when using highlight.xsl:
    Error at xsl:when on line 47 of file:/F:/work/docbook-tools/docbook-xsl/highlighting/common.xsl:
    Variable highlight.default.language has not been declared


    Tuesday, April 13, 2010, 4:01:31 PM, you wrote:

    MM> I am not using docbook-xsl/fo/docbook.xsl when doing highlithing.
    MM> Instead I use: docbook-xsl/fo/highlight.xsl

    MM> Ref:
    MM> http://www.sagehill.net/docbookxsl/SyntaxHighlighting.html




  • 8.  Re: [docbook-apps] Colored listings

    Posted 04-14-2010 11:30
    On Wed, 14 Apr 2010 15:02:17 +0400
    ????????? ???????? <amart@mail.ru> wrote:

    > Hello Mathieu,
    >
    > I have got an error when using highlight.xsl:
    > Error at xsl:when on line 47 of
    > file:/F:/work/docbook-tools/docbook-xsl/highlighting/common.xsl:
    > Variable highlight.default.language has not been declared


    Set the parameter to the language you want to use.

    HTH


    --

    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk



  • 9.  Re: [docbook-apps] Colored listings

    Posted 04-13-2010 11:54
    On Tue, 13 Apr 2010 15:20:47 +0400
    ????????? ???????? <amart@mail.ru> wrote:

    > As I understand, there is no way to use syntax highlighting with
    > xsltproc, it's requres Saxon. Next, Saxon itself does not process
    > XInclude's, and I need to use xmllint to do this.

    Saxon can process xIncludes, but so can the xml parser.
    see http://www.sagehill.net/docbookxsl/Xinclude.html
    for xsltproc using includes


    Coloured output is normally HTML?
    Not sure if I've ever seen it in PDF.

    HTH

    --

    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk