docbook-apps

  • 1.  Sigplan template, the continuing saga: Paragraph indents

    Posted 02-05-2014 03:00
    In my continuing efforts to get a sigplan compatible docbook template,
    I'm going pretty well, and getting much further than I ever thought that
    I would. I'd like to present a small issue that I haven't found a quick
    solution to:

    How do I make it so that the first paragraph after a section heading is
    not indented? I have it so that all paragraphs are normally indented by
    a small amount, but I can't seem to remove the indent for paragraphs
    occuring right after the section heading. Any suggestions would be
    appreciated.

    --
    Aaron W. Hsu | arcfide@sacrideo.us | http://www.sacrideo.us
    ???? ????????? ???????? ?????? ?????? ??????????? ???????? ??????????




  • 2.  Re: [docbook-apps] Sigplan template, the continuing saga: Paragraph indents

    Posted 02-10-2014 19:31
    Hi Aaron,
    This can be done, but it is surprisingly tricky to select the first para
    after a section title in the general case. The content model for
    section allows all kinds of elements to appear before the first para
    element. For example, an itemizedlist can appear first in a section, but
    you probably would not want the first para after that list to be outdented.

    So the select statement has to specify which elements you want to allow
    between the
    start tag and the first <para> element. That
    would include some elements that are not expressed in the output but
    that still affect the select statement:

    title
    titleabbrev
    subtitle
    info
    indexterm
    remark
    annotation

    The following customized template is copied from the match="d:para"
    template in fo/block.xsl. It selects the children of section, then
    eliminates the allowed elements before para, then takes the first
    remaining element [1], and then checks to see if it is a para
    (self::d:para). Only then is that template applied. The only
    difference in the template body is to add a text-indent="0pt" to the
    fo:block to override the 'para.properties' attribute set.

    <xsl:template match="d:section/*[not(self::d:title or
    self::d:subtitle or
    self::d:titleabbrev or
    self::d:info or
    self::d:indexterm or
    self::d:remark or
    self::d:annotation)][1][self::d:para]">

    <xsl:variable name="keep.together">
    <xsl:call-template name="pi.dbfo_keep-together"/>
    </xsl:variable>
    <fo:block xsl:use-attribute-sets="para.properties" text-indent="0pt">
    <xsl:if test="$keep.together != ''">
    <xsl:attribute name="keep-together.within-column"><xsl:value-of
    select="$keep.together"/></xsl:attribute>
    </xsl:if>
    <xsl:call-template name="anchor"/>
    <xsl:apply-templates/>
    </fo:block>
    </xsl:template>



    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    On 2/4/2014 6:59 PM, Aaron W. Hsu wrote:
    > In my continuing efforts to get a sigplan compatible docbook template,
    > I'm going pretty well, and getting much further than I ever thought that
    > I would. I'd like to present a small issue that I haven't found a quick
    > solution to:
    >
    > How do I make it so that the first paragraph after a section heading is
    > not indented? I have it so that all paragraphs are normally indented by
    > a small amount, but I can't seem to remove the indent for paragraphs
    > occuring right after the section heading. Any suggestions would be
    > appreciated.
    >