Odsazeni odstavcu..
Jiri Tyr
jiri.tyr na cern.ch
Čtvrtek Květen 3 15:12:00 CEST 2007
Dobry den,
jeste jeden tip pro ty, kteri by chteli mit odsazovani odstavcu, jak je
tomu zvykem v LaTeXu - prvni odstavec kapitoly neodsazovat, dalsi
odsadit. Odsazuji se jen odstavce, jejichz predek je chapter, section,
preface, dedication a abstract. Priklad:
Kapitola 1
Ze zivota hmyzu
Xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx.
Xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx.
Xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx.
Provedl jsem to touto customizaci:
Pro FO:
<xsl:template match="para[position() > 1 and (boolean(@role) = false or
@role != 'noindent') and (name(..) = 'chapter' or name(..) = 'section'
or name(..) = 'preface' or name(..) = 'dedication' or name(..) =
'abstract')]">
<fo:block text-indent="1.5em"
xsl:use-attribute-sets="normal.para.spacing">
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="formalpara[position() > 1 and (boolean(@role) =
false or @role != 'noindent') and (name(..) = 'chapter' or name(..) =
'section' or name(..) = 'preface' or name(..) = 'dedication' or name(..)
= 'abstract')]">
<fo:block text-indent="1.5em"
xsl:use-attribute-sets="normal.para.spacing">
<xsl:if test="@id">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
Pro XHTML:
<xsl:template match="para[position() > 1 and (boolean(@role) = false or
@role != 'noindent') and (name(..) = 'chapter' or name(..) = 'section'
or name(..) = 'preface' or name(..) = 'dedication' or name(..) =
'abstract')]">
<xsl:call-template name="paragraph_indent">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:if test="position() = 1 and parent::listitem">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="parent::listitem"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="paragraph_indent">
<xsl:param name="class" select="''"/>
<xsl:param name="content"/>
<xsl:variable name="p">
<p class="indent">
<xsl:call-template name="dir"/>
<xsl:if test="$class != ''">
<xsl:attribute name="class">
<xsl:value-of select="$class"/>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="$content"/>
</p>
</xsl:variable>
<xsl:choose>
<xsl:when test="$html.cleanup != 0">
<xsl:call-template name="unwrap.p">
<xsl:with-param name="p" select="$p"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$p"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Do CSS pridat:
p.indent {
text-indent: 1.5em;
}
Pokud nechcete nejaky odstavec odsadit, staci odstavec nadefinova takto:
<para role="noindent">Nejaky text....</para>
S pozdravem,
Jiri Tyr
Další informace o konferenci Docbook