This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[docbook-apps] Indenting a paragraph


I like the european way of typesetting paragraphs, where
the first paragraph after a heading isn't indented, but
all following paragraphs are.  Here's an idea in ASCII art:

HEADING ONE

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx
   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx


So I set up a customized docbook (mydocbk.dtd) attached:

8<------cut----------------------------8<

<!-- This adds leadpara to the mix of block elements -->
<!-- that can be used in chapter, section, etc.    -->
<!ENTITY % local.divcomponent.mix "|leadpara">

<!-- load DocBook -->
<!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
        "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd";>
%DocBookDTD;

<!ELEMENT leadpara (%para.char.mix;|%para.mix;)*>

8<------cut----------------------------8<


which adds an additional element <leadpara>, into my
block elements.

The element <leadpara> is a container for the first paragraph
after a heading.  This leaves the element <para> to behave like
a normal paragraph.

My source text now looks like:

<sect1><title>Overview</title></sect1>
  <leadpara>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</leadpara>
  <para>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<para>

To get my leading paragraph / indented normal paragraph
I use the following code in my customization layer:

8<------cut----------------------------8<

<!-- ~~~~~~~~~~~~~~~~ -->
<!-- Paragraph layout -->
<!-- ~~~~~~~~~~~~~~~~ -->
<xsl:attribute-set name="normal.para.spacing">
   <xsl:attribute name="text-indent">0in</xsl:attribute>
</xsl:attribute-set>

<xsl:template match="leadpara">
  <fo:block xsl:use-attribute-sets="normal.para.spacing">
    <xsl:call-template name="anchor"/>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="para">
  <fo:block xsl:use-attribute-sets="normal.para.spacing">
    <xsl:attribute name="space-before.optimum">0pt</xsl:attribute>
    <xsl:attribute name="space-before.minimum">0pt</xsl:attribute>
    <xsl:attribute name="space-before.maximum">2pt</xsl:attribute>
    <xsl:attribute name="text-indent">0.15in</xsl:attribute>
    <xsl:call-template name="anchor"/>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

8<------cut----------------------------8<

this works fine for paragraphs, but it fucks up badly when
I want to use it in an <itemizedlist> block.  For example
the source text:

<itemizedlist>
  <listitem>
	<leadpara>A new term appears in <firstterm>emphasis</firstterm>
	    when it is introduced.</leadpara>
  <listitem>
</itemizedlist>

when processed through a saxon/fop workflow looks like crap.

If I can show it with ASCII art (where o signifies a bullet):

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

o
  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

where the line that immediately follows the bullet is skipped.

How can I set up the list so that there isn't a blank line
immediately following a bullet?  That is

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

o xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]