Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Mar 2014 18:10:32 +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: r44133 - head/share/xml
Message-ID:  <201403051810.s25IAWmI028446@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gabor
Date: Wed Mar  5 18:10:32 2014
New Revision: 44133
URL: http://svnweb.freebsd.org/changeset/doc/44133

Log:
  - Rewrite text wrapping for HTML line numbering so that empty lines
    are not lost
  
  Reported by:	wblock

Modified:
  head/share/xml/freebsd-xhtml-common.xsl

Modified: head/share/xml/freebsd-xhtml-common.xsl
==============================================================================
--- head/share/xml/freebsd-xhtml-common.xsl	Wed Mar  5 17:26:02 2014	(r44132)
+++ head/share/xml/freebsd-xhtml-common.xsl	Wed Mar  5 18:10:32 2014	(r44133)
@@ -298,9 +298,27 @@
   <xsl:template name="wrap.text">
     <xsl:param name="content"/>
 
-    <xsl:for-each select="str:tokenize($content, '&#x0A;')">
-      <span class="verbatim"><xsl:value-of select="."/>&#x0A;</span>
-    </xsl:for-each>
+    <xsl:choose>
+      <xsl:when test="starts-with($content, '&#x0A;')">
+	<span class="verbatim">&#x200b;</span>
+
+	<xsl:call-template name="wrap.text">
+	  <xsl:with-param name="content" select="substring-after($content, '&#x0A;')"/>
+	</xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="contains($content, '&#x0A;')">
+	<span class="verbatim"><xsl:value-of select="substring-before($content, '&#x0A;')"/>&#x0A;</span>
+
+	<xsl:call-template name="wrap.text">
+	  <xsl:with-param name="content" select="substring-after($content, '&#x0A;')"/>
+	</xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+	<span class="verbatim"><xsl:value-of select="$content"/>&#x0A;</span>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
   <!-- XXX: breaks line numbering and syntax highlighting that we do not use



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