Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jan 2014 14:34:09 +0000 (UTC)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org
Subject:   svn commit: r43630 - head/share/xml
Message-ID:  <201401221434.s0MEY9YQ079374@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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='"&apos;"'/>
+    <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 = '&quot;' 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 = '&#160;') and $next != '.' and
+	$next != '}' and $next != ' ' and $next != '&#160;'">
+	<xsl:text>&#160;</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
 -->



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401221434.s0MEY9YQ079374>