]> granicus.if.org Git - docbook-dsssl/commitdiff
Put programlisting in fo:block-container with writing-mode="lr-tb"
authorBob Stayton <bobs@sagehill.net>
Mon, 9 Mar 2009 17:06:48 +0000 (17:06 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 9 Mar 2009 17:06:48 +0000 (17:06 +0000)
when text direction is right to left because all program languages
are left-to-right.

xsl/fo/verbatim.xsl

index 2ac4eb96855d86ae3955e85c86aa8cf662463b04..82355f17a9dbfb4dc0d591671b3bc3c7014de473 100644 (file)
   </xsl:variable>
 
   <xsl:choose>
-    <xsl:when test="@width != ''">
+    <!-- Need a block-container for these features -->
+    <xsl:when test="@width != '' or
+                    (self::programlisting and
+                    starts-with($writing.mode, 'rl'))">
       <fo:block-container start-indent="0pt" end-indent="0pt">
-        <xsl:attribute name="width">
-          <xsl:value-of select="concat(@width, '*', $monospace.verbatim.font.width)"/>
-        </xsl:attribute>
+        <xsl:if test="@width != ''">
+          <xsl:attribute name="width">
+            <xsl:value-of select="concat(@width, '*', $monospace.verbatim.font.width)"/>
+          </xsl:attribute>
+        </xsl:if>
+        <!-- All known program code is left-to-right -->
+        <xsl:if test="self::programlisting and
+                      starts-with($writing.mode, 'rl')">
+          <xsl:attribute name="writing-mode">lr-tb</xsl:attribute>
+        </xsl:if>
         <xsl:copy-of select="$block.content"/>
       </fo:block-container>
     </xsl:when>