docbook-apps

  • 1.  Re: [docbook-apps] line-breaks after slashes in filenames

    Posted 01-21-2008 14:06
    Hi,

    > I'm using docbook - xsl-fo and fop to create a pdf. In my text I have
    > occasionally the problem, that a part marked with <filename> breaks
    > inappropriate like this:
    >
    > some long and random text /
    > etc/passwd some more text
    >
    > This is not what I want, of course. I want to get the '/' on the next
    > line. Its ok to break after a slash on longer filenames, but not after
    > the first.
    >
    > I tried to force a line-break by using a processing instruction to
    > insert a <fo:block/> element in my FO, but this breaks the justification
    > of the previous line, which also doesn't look pretty good.
    >
    > How can I solve this problem? A solution that would allow forced
    > line-breaks without breaking the justification would be ok for me.

    For ulinks there are already two parameters how does URL breaking.

    Did you already know the following parameters?
    http://docbook.sourceforge.net/release/xsl/current/doc/fo/ulink.hyphenate.html
    http://docbook.sourceforge.net/release/xsl/current/doc/fo/ulink.hyphenate.chars.html

    However, these apply to ulinks, not to filenames. Try the following:

    1. Write a customization layer
    2. Set hyphenation="false" to avoid any hyphenation
    3. Call the named template "hyphenate-url" in your filename template. This
    template takes care of the appropriate location and inserts the character
    from the ulink.hyphenate parameter.

    This snippet needs to be inserted into your customization layer:

    <xsl:template match="filename">
    <fo:inline hyphenate="false">
    <xsl:apply-templates mode="hyphenate-url"/>
    </fo:inline>
    </xsl:template>

    The above template can be improved, but it's just the general idea.


    Hope that helps,
    Tom



  • 2.  Re: [docbook-apps] line-breaks after slashes in filenames

    Posted 01-21-2008 19:07


    Thomas Schraitle wrote:
    >
    >
    >
    > <xsl:template match="filename">
    > <fo:inline hyphenate="false">
    > <xsl:apply-templates mode="hyphenate-url"/>
    > </fo:inline>
    > </xsl:template>
    >
    > The above template can be improved, but it's just the general idea.
    >

    That just works perfect for me. Thank you.

    Bjoern
    --
    View this message in context: http://www.nabble.com/line-breaks-after-slashes-in-filenames-tp14997510p15004121.html
    Sent from the docbook apps mailing list archive at Nabble.com.