svn commit: r43630 - head/share/xml

Gabor Kovesdan gabor at FreeBSD.org
Wed Jan 22 14:34:09 UTC 2014


Author: gabor
Date: Wed Jan 22 14:34:08 2014
New Revision: 43630
URL: http://svnweb.freebsd.org/changeset/doc/43630

Log:
  - 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

Modified:
  head/share/xml/freebsd-fo.xsl

Modified: head/share/xml/freebsd-fo.xsl
==============================================================================
--- head/share/xml/freebsd-fo.xsl	Wed Jan 22 12:13:12 2014	(r43629)
+++ head/share/xml/freebsd-fo.xsl	Wed Jan 22 14:34:08 2014	(r43630)
@@ -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 = '&#xA;' 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>&#x00AD;</xsl:text>
+      </xsl:when>
+      <xsl:when test="$head = '.' and translate($next, '0123456789', '') != ''">
+	<xsl:text>.</xsl:text>
+	<xsl:text>&#x00AD;</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>&#x00AD;</xsl:text>
+      </xsl:when>
+      <xsl:when test="$next = '('">
+	<xsl:value-of select="$head"/>
+	<xsl:text>&#x00AD;</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
 -->


More information about the svn-doc-all mailing list