- Line wrap indicators are rendered in the verbatim texts with the help
of soft hyphens. However, FOP does not handle well soft hyphens when placed after certain characters. Apply a workaround for this. PR: docs/184606 Submitted by: cs
This commit is contained in:
parent
cee7156e7e
commit
5daa221a87
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=43630
1 changed files with 45 additions and 0 deletions
|
@ -513,6 +513,51 @@
|
|||
<!-- Suppress list titles -->
|
||||
<xsl:template match="db:title" mode="list.title.mode"/>
|
||||
|
||||
<!-- Soft-hyphen workaround for verbatim hyphenation -->
|
||||
<xsl:template name="hyphenate.verbatim">
|
||||
<xsl:param name="content"/>
|
||||
<xsl:variable name="apos" select='"'"'/>
|
||||
<xsl:variable name="head" select="substring($content, 1, 1)"/>
|
||||
<xsl:variable name="tail" select="substring($content, 2)"/>
|
||||
<xsl:variable name="next" select="substring($tail, 1, 1)"/>
|
||||
<xsl:choose>
|
||||
<!-- Place soft-hyphen after space or non-breakable space. -->
|
||||
<xsl:when test="$next = '
' or $next = '' or $next = '"' or
|
||||
$next = '.' or $next = ',' or $next = '-' or $next = '/' or
|
||||
$next = $apos or $next = ':' or $next = '!' or $next = '|' or
|
||||
$next = '?' or $next = ')'">
|
||||
<xsl:value-of select="$head"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="($head = ' ' or $head = ' ') and $next != '.' and
|
||||
$next != '}' and $next != ' ' and $next != ' '">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:text>­</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$head = '.' and translate($next, '0123456789', '') != ''">
|
||||
<xsl:text>.</xsl:text>
|
||||
<xsl:text>­</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$hyphenate.verbatim.characters != '' and
|
||||
translate($head, $hyphenate.verbatim.characters, '') = '' and
|
||||
translate($next, $hyphenate.verbatim.characters, '') != ''">
|
||||
<xsl:value-of select="$head"/>
|
||||
<xsl:text>­</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$next = '('">
|
||||
<xsl:value-of select="$head"/>
|
||||
<xsl:text>­</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$head"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="$tail">
|
||||
<xsl:call-template name="hyphenate.verbatim">
|
||||
<xsl:with-param name="content" select="$tail"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
TITLEPAGE TEMPLATES
|
||||
-->
|
||||
|
|
Loading…
Reference in a new issue