See the following section from Bob Stayton's book about
using a hyphenation character (e.g. an arrow of some kind) to indicate that a
line in a programlisting has been broken for typographical
reasons:
http://www.sagehill.net/docbookxsl/FittingText.html#BreakLongLines
David
From:
[mailto:]
Sent: Monday, June 22, 2009 2:25
PM
To:
Subject: [docbook]
controlling the line length of programlisting
Has anyone tried to use schematron
to enforce the line length of programlisting?
We want to be able to limit the line-length of our
programlistings when we are authoring.
That is, we need to be informed when a line length in a programlisting
exceeds a number of characters (e.g., 72)
so that we can go in and format the lines properly. E.g., I'm imagining
that this would involve counting the number of characters before a eol and
then comparing
this number against the
character limit (72).
If anyone
has an alternative suggestion, that would be greatly appreciated.
Thank you,
Kate
Subject: Re: [docbook] prettyprinting code
snippets
From: Hannes Magnusson
<>
To: DavePawson <>
Date: Sun, 14 Jun 2009 12:59:31 +0200
On Fri, Jun 12, 2009 at 19:01,
DavePawson<> wrote:
> Mauricio Tavares
wrote:
>>
>> I am writing a an article in which
I am including quite a few xml
>> examples and snippets. I have been
using <programlisting> but was now
>> wondering if there is a
way I can prettyprint those snippets. Anyone?
>
>
> ONly if
the code is well laid out in the first place?
> I try to break lines at
<= 70 chars to make sure
> it fits on a screen.
>
> If
you want code highlighting etc.. sorry no.
When the PHP
documentations where using DocBook-XSL we used to add a
customization layer
to add special "tags" around <programlisting>, and
then post process
the output to syntax highlight and format examples
(php, xml,
..).
For example with <programlisting
role="php"><?php..
?></programlisting> the customization
layer would generate
"<phpcode><?php.. ?></phpcode>" that
was then post processed with
other applications.
Currently we are
using "PhD" (PHP based Docbook Renderer) which
handles all these kinds of
things :)
-Hannes