docbook-apps message
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
| [List Home]
Subject: Re: [docbook-apps] Disabling hyphenation on selected strings
- From: Ron Catterall <ron@catterall.net>
- To: "Andrew McFarland" <aamcfarland@gmail.com>
- Date: Tue, 6 May 2008 16:10:58 -0500
Title: Re: [docbook-apps] Disabling hyphenation on
selected strin
Andrew
This works for me. I was having
trouble with URLs which got hyphenated and new lined. For DB 4.5
remove the d: bits. Messy but it seems to work OK with XEP.
I've never tested it with FOP, but it might work. Early FOP has
some problems with keep-together, possibly fixed by now.
Ron
<!--
====================================================================
-->
<!--
Allow use of
<phrase
role="keep-together">qwerty</phrase>
to prevent hyphenation and a line break within the phrase
-->
<xsl:template match="d:phrase[@role[contains(.,
'keep-together')]]">
<xsl:param
name="no-hyphenate" select="false()"/>
<xsl:param
name="content">
<xsl:apply-templates/>
</xsl:param>
<fo:inline
xsl:use-attribute-sets="monospace.properties" font-family="{$body.font.family}">
<xsl:if test="@role[contains(.,
'keep-together')]">
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
<xsl:attribute name="hyphenate">false</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$no-hyphenate">
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
<xsl:attribute name="hyphenate">false</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<!-- this is a
zero-width space to intentionally provoke an AntennaHouse bug.
The FO spec says that
hyphenation-character can only be on fo:block and
fo:character, but having
anything here provides the correct result. -->
<xsl:attribute name="hyphenation-character">
<xsl:value-of select="'​'"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="ancestor::d:footnote">
<xsl:attribute name="font-size">85%</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:if test="@dir">
<xsl:attribute name="direction">
<xsl:choose>
<xsl:when
test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
<xsl:otherwise>rtl</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="$content"/>
</fo:inline>
</xsl:template> <!-- END
match="d:phrase[@role[contains(., 'keep-together')]]"
-->
<!--
====================================================================
-->
I'd like to be able to mark arbitrary
subsections of para elements as
"non-hyphenatable", something like this:
<para>Hyphenate anywhere here <span
type="no-hyphens">Do not hyphenate
this text</span> Hyphenate anywhere here</para>
Is this possible?
--
You did not read the manual
Our tech writer is sad
Locked in the toilet, he is crying
---------------------------------------------------------------------
To unsubscribe, e-mail:
docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail:
docbook-apps-help@lists.oasis-open.org
--
Ron Catterall, Phd, DSc
email: ron@catterall.net
Prolongacion de Hidalgo 140
http://catterall.net/
San Felipe del Agua
tel:
+52 951 520 1821
Oaxaca 68020
Mexico
fax:
+1 530 348 8309
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
| [List Home]