docbook-apps

  • 1.  Index entry fo:block disrupts keep-with-next.within-column

    Posted 06-02-2015 19:33
    I noticed a section title separated from the first paragraph in its
    section by a PDF page break. The title of the section is at the bottom
    of one page and the first paragraph at the top of the next page. I'm
    using the docbook-xsl-ns-1.78.1 stylesheets.

    The problem is caused by an index entry between the title and the
    first paragraph. If I remove the index entry, the title is kept-with
    the following para.

    The index entry results in a fo:block to mark the internal destination:

    <fo:block id="d0e240"></fo:block>

    So the title is satisfied with being kept-with the index entry fo:block.

    I am considering customizing the fo:block for index entries to add a
    keep-with-next.within-column="always" attribute.

    Does anyone know of a better way to prevent index entries from
    interfering with keep-with-next behavior?

    Thanks!

    Peter

    ****** My DocBook *****




    <indexterm>
    <primary>containers</primary>
    </indexterm>

    <para>Containers ...


    ****** The corresponding FO *****

    <fo:block>
    <fo:block keep-together.within-column="always" margin-left="0pt"
    font-family="sans-serif,Symbol,ZapfDingbats">
    <fo:block keep-with-next.within-column="always">
    <fo:block font-family="sans-serif,Symbol,ZapfDingbats"
    font-weight="bold" keep-with-next.within-column="always"
    space-before.minimum="0.8em" space-before.optimum="1.0em"
    space-before.maximum="1.2em" text-align="start" start-indent="0pt">
    <fo:block font-size="12pt" color="#405D99"
    font-weight="600" space-before.optimum="2.0em"
    space-before.minimum="1.8em"
    space-before.maximum="2.2em">Containers</fo:block>
    </fo:block>
    </fo:block>
    </fo:block>
    </fo:block>
    </fo:block>
    <fo:block id="d0e240"></fo:block>
    <fo:block space-before.optimum="1.7em" space-before.minimum="1.5em"
    space-before.maximum="1.9em">
    Containers ...



  • 2.  Re: Index entry fo:block disrupts keep-with-next.within-column

    Posted 06-03-2015 19:24
    In case it's useful to anyone, adding
    keep-with-next.within-column="always" to the fo:block for index
    entries did solve my problem. The title stays with the index entry and
    the index entry stays with the first visible content of the section.

    Here's the customization I used to do it. I had to remove the
    xsl:choose condition for using xep.extensions. The references to
    entities defined in common/entities.ent were causing problems because
    the relative path to the entity file was hard to include in my
    customization layer. So if you're relying on xep.extensions, this
    might not work.







    <xsl:template match="d:indexterm" name="indexterm">

    <xsl:variable name="wrapper.name">
    <xsl:choose>
    <xsl:when test="$axf.extensions != 0 or $fop1.extensions != 0">
    <xsl:call-template name="inline.or.block"/>
    </xsl:when>
    <xsl:otherwise>fo:wrapper</xsl:otherwise>
    </xsl:choose>
    </xsl:variable>

    <xsl:element name="{$wrapper.name}">
    <xsl:attribute name="id">
    <xsl:call-template name="object.id"/>
    </xsl:attribute>

    <xsl:attribute name="keep-with-next.within-column">
    <xsl:text>always</xsl:text>
    </xsl:attribute>

    <xsl:comment>
    <xsl:call-template name="comment-escape-string">
    <xsl:with-param name="string">
    <xsl:value-of select="d:primary"/>
    <xsl:if test="d:secondary">
    <xsl:text>, </xsl:text>
    <xsl:value-of select="d:secondary"/>
    </xsl:if>
    <xsl:if test="d:tertiary">
    <xsl:text>, </xsl:text>
    <xsl:value-of select="d:tertiary"/>
    </xsl:if>
    </xsl:with-param>
    </xsl:call-template>
    </xsl:comment>
    </xsl:element>
    </xsl:template>

    On Tue, Jun 2, 2015 at 3:33 PM, Peter Desjardins
    <peter.desjardins.us@gmail.com> wrote:
    > I noticed a section title separated from the first paragraph in its
    > section by a PDF page break. The title of the section is at the bottom
    > of one page and the first paragraph at the top of the next page. I'm
    > using the docbook-xsl-ns-1.78.1 stylesheets.
    >
    > The problem is caused by an index entry between the title and the
    > first paragraph. If I remove the index entry, the title is kept-with
    > the following para.
    >
    > The index entry results in a fo:block to mark the internal destination:
    >
    > <fo:block id="d0e240"></fo:block>
    >
    > So the title is satisfied with being kept-with the index entry fo:block.
    >
    > I am considering customizing the fo:block for index entries to add a
    > keep-with-next.within-column="always" attribute.
    >
    > Does anyone know of a better way to prevent index entries from
    > interfering with keep-with-next behavior?
    >
    > Thanks!
    >
    > Peter
    >
    > ****** My DocBook *****
    >
    >

    >
    >
    > <indexterm>
    > <primary>containers</primary>
    > </indexterm>
    >
    > <para>Containers ...
    >
    >
    > ****** The corresponding FO *****
    >
    > <fo:block>
    > <fo:block keep-together.within-column="always" margin-left="0pt"
    > font-family="sans-serif,Symbol,ZapfDingbats">
    > <fo:block keep-with-next.within-column="always">
    > <fo:block font-family="sans-serif,Symbol,ZapfDingbats"
    > font-weight="bold" keep-with-next.within-column="always"
    > space-before.minimum="0.8em" space-before.optimum="1.0em"
    > space-before.maximum="1.2em" text-align="start" start-indent="0pt">
    > <fo:block font-size="12pt" color="#405D99"
    > font-weight="600" space-before.optimum="2.0em"
    > space-before.minimum="1.8em"
    > space-before.maximum="2.2em">Containers</fo:block>
    > </fo:block>
    > </fo:block>
    > </fo:block>
    > </fo:block>
    > </fo:block>
    > <fo:block id="d0e240"></fo:block>
    > <fo:block space-before.optimum="1.7em" space-before.minimum="1.5em"
    > space-before.maximum="1.9em">
    > Containers ...