RE: [docbook] controlling the line length of programlisting

From
<>
Date
2009-06-23T13:02:28+00:00
ID
Thread
RE: [docbook] controlling the line length of programlisting
Hi David,

Thanks for pointing out this section
in Bob Stayton's book. However, if I'm reading the section correctly,

the breaking of text is done during
the build processing.  Wouldn't it be easier if we could alert the
writer right away

that he/she needs to edit the programlisting?
My software package has print margin feature, but it is only available
in the 

text mode. 

Any suggestions?

Kate

"David Cramer"
<> 

06/22/2009 03:34 PM

To

<>, <>

cc

Subject

RE: [docbook] controlling the line length
of programlisting

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