You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Yang SongXiang <a2...@gmail.com> on 2008/09/22 07:08:29 UTC

How to auto-wrap the out of boundary content in programlisting?

Hi, All

I put some code in <programlisting>, but seems they are too long,  the
PDF output is out of boundary of page

My sample DocBook XML file is like this:
---------------------------------
<programlisting>This is too long line too long line too long line too
long line too long line too long line too long line too long line too
long line<programlisting>
---------------------------------

How can I control the out of boundary programlisting to be auto-wrap?


Thanks
-Scord

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to auto-wrap the out of boundary content in programlisting?

Posted by Andreas Delmelle <an...@telenet.be>.
On Sep 22, 2008, at 07:08, Yang SongXiang wrote:

Hi

> I put some code in <programlisting>, but seems they are too long,  the
> PDF output is out of boundary of page
>
> My sample DocBook XML file is like this:
> ---------------------------------
> <programlisting>This is too long line too long line too long line too
> long line too long line too long line too long line too long line too
> long line<programlisting>
> ---------------------------------
>
> How can I control the out of boundary programlisting to be auto-wrap?

IIC, then the template for a <programlisting> will yield a FO result  
like:

<fo:block white-space-treatment="preserve" linefeed-treatment="preserve"
           white-space-collapse="false" wrap-option="no-wrap">
...

Setting the wrap-option property makes it prohibited for the  
formatter to insert implicit line-breaks. (see: http://www.w3.org/TR/ 
xsl/#wrap-option)

Removing this property would allow FOP to break the lines, but....

Note that the result of allowing implicit line-breaks in pre- 
formatted code blocks will probably be suboptimal. If you have  
something like:

     [... a very long indented line of code ...]
     [... next line ...]

The formatter will keep the white-space indentation for the first  
line, but the second line will have no leading white-space, so you  
may end up with something looking like:

    [... a very long indented
line of code ...]
    [... next line ...]



HTH!

Cheers

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org