]> granicus.if.org Git - docbook-dsssl/commitdiff
When passivetex.extensions=1 character ​ is inserted between all occurences...
authorJirka Kosek <jirka@kosek.cz>
Thu, 15 Nov 2001 19:34:59 +0000 (19:34 +0000)
committerJirka Kosek <jirka@kosek.cz>
Thu, 15 Nov 2001 19:34:59 +0000 (19:34 +0000)
xsl/fo/docbook.xsl
xsl/fo/passivetex.xsl [new file with mode: 0644]

index 1cdf05b4b7196f5395fd11ac2e25fa36a2b2c4d1..91ce4d22bca260716c2f7fc19515012e6863e9a1 100644 (file)
@@ -65,6 +65,7 @@
 <xsl:include href="ebnf.xsl"/>
 
 <xsl:include href="fop.xsl"/>
+<xsl:include href="passivetex.xsl"/>
 <xsl:include href="xep.xsl"/>
 
 <!-- ==================================================================== -->
   </fo:block>
 </xsl:template>
 
-<xsl:template match="text()">
-  <xsl:value-of select="."/> 
-</xsl:template>
-
 <xsl:template match="/">
   <xsl:message>
     <xsl:text>Making </xsl:text>
diff --git a/xsl/fo/passivetex.xsl b/xsl/fo/passivetex.xsl
new file mode 100644 (file)
index 0000000..a8e14bf
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version='1.0' encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version='1.0'>
+
+<!-- ********************************************************************
+     $Id$
+     ********************************************************************
+      This extension stops PassiveTeX from merging subsequent '-' to 
+      dashes. You must set passivetex.extensions to '1' if you want get
+      this functionality.
+     ******************************************************************** -->
+
+<xsl:template match="text()">
+  <xsl:choose>
+    <xsl:when test="$passivetex.extensions != 0">
+      <xsl:call-template name="passivetex.dash.subst">
+        <xsl:with-param name="string" select="."/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="."/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="passivetex.dash.subst">
+  <xsl:param name="string"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($string, '--')">
+      <xsl:variable name="rest">
+        <xsl:call-template name="passivetex.dash.subst">
+          <xsl:with-param name="string"
+                          select="concat('-', substring-after($string, '--'))"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:value-of select="concat(substring-before($string, '--'),
+                                   '-&#x200b;',
+                                   $rest)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$string"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
+