]> granicus.if.org Git - docbook-dsssl/commitdiff
Support shade.verbatim parameter
authorNorman Walsh <ndw@nwalsh.com>
Wed, 8 Aug 2001 00:17:28 +0000 (00:17 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Wed, 8 Aug 2001 00:17:28 +0000 (00:17 +0000)
xsl/html/param.xsl
xsl/html/verbatim.xsl

index 526c084d0122e0813c4eac4b3dc46064feb3d6fe..0e2ef95fc8b2a2497d9fd734f55cfc64d8ebb959 100644 (file)
@@ -1217,4 +1217,23 @@ will be passed through to the HTML as a class attribute on a
 <xsl:param name="olink.sysid" select="'sysid='" doc:type='string'/>
 <xsl:param name="olink.resolver" select="'/cgi-bin/olink?'" doc:type='string'/>
 
+<xsl:param name="shade.verbatim" select="0" doc:type="boolean"/>
+
+<!--
+  ;; REFENTRY shade-verbatim
+  ;; PURP Should verbatim environments be shaded?
+  ;; DESC
+  ;; If true, a table with '($shade-verbatim-attr$)' attributes will be
+  ;; wrapped around each verbatim environment.  This gives the effect
+  ;; of a shaded verbatim environment.
+  ;; /DESC
+  ;; AUTHOR N/A
+  ;; /REFENTRY
+-->
+
+<xsl:attribute-set name="shade.verbatim.style">
+  <xsl:attribute name="border">0</xsl:attribute>
+  <xsl:attribute name="bgcolor">#E0E0E0</xsl:attribute>
+</xsl:attribute-set>
+
 </xsl:stylesheet>
index bfaa1578e80773aeb0f83495f534a90916f4b44b..854d39ff7993f6e1b3fd6529968338ca3b788ba1 100644 (file)
     <a href="{$id}"/>
   </xsl:if>
 
+  <xsl:variable name="content">
+    <xsl:choose>
+      <xsl:when test="$suppress-numbers = '0'
+                      and @linenumbering = 'numbered'
+                      and $use.extensions != '0'
+                      and $linenumbering.extension != '0'">
+        <xsl:variable name="rtf">
+          <xsl:apply-templates/>
+        </xsl:variable>
+        <pre class="{name(.)}">
+          <xsl:call-template name="number.rtf.lines">
+            <xsl:with-param name="rtf" select="$rtf"/>
+          </xsl:call-template>
+        </pre>
+      </xsl:when>
+      <xsl:otherwise>
+        <pre class="{name(.)}">
+          <xsl:apply-templates/>
+        </pre>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:choose>
-    <xsl:when test="$suppress-numbers = '0'
-                    and @linenumbering = 'numbered'
-                    and $use.extensions != '0'
-                    and $linenumbering.extension != '0'">
-      <xsl:variable name="rtf">
-        <xsl:apply-templates/>
-      </xsl:variable>
-      <pre class="{name(.)}">
-        <xsl:call-template name="number.rtf.lines">
-          <xsl:with-param name="rtf" select="$rtf"/>
-        </xsl:call-template>
-      </pre>
+    <xsl:when test="$shade.verbatim != 0">
+      <table xsl:use-attribute-sets="shade.verbatim.style">
+        <tr>
+          <td>
+            <xsl:copy-of select="$content"/>
+          </td>
+        </tr>
+      </table>
     </xsl:when>
     <xsl:otherwise>
-      <pre class="{name(.)}">
-        <xsl:apply-templates/>
-      </pre>
+      <xsl:copy-of select="$content"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
     <xsl:apply-templates/>
   </xsl:variable>
 
+  <xsl:variable name="content">
+    <xsl:choose>
+      <xsl:when test="$suppress-numbers = '0'
+                      and @linenumbering = 'numbered'
+                      and $use.extensions != '0'
+                      and $linenumbering.extension != '0'">
+        <xsl:choose>
+          <xsl:when test="@class='monospaced'">
+            <pre class="{name(.)}">
+              <xsl:call-template name="number.rtf.lines">
+                <xsl:with-param name="rtf" select="$rtf"/>
+              </xsl:call-template>
+            </pre>
+          </xsl:when>
+          <xsl:otherwise>
+            <div class="{name(.)}">
+              <xsl:call-template name="number.rtf.lines">
+                <xsl:with-param name="rtf" select="$rtf"/>
+              </xsl:call-template>
+            </div>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="@class='monospaced'">
+            <pre class="{name(.)}">
+              <xsl:copy-of select="$rtf"/>
+            </pre>
+          </xsl:when>
+          <xsl:otherwise>
+            <div class="{name(.)}">
+              <xsl:copy-of select="$rtf"/>
+            </div>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:choose>
-    <xsl:when test="$suppress-numbers = '0'
-                    and @linenumbering = 'numbered'
-                    and $use.extensions != '0'
-                    and $linenumbering.extension != '0'">
-      <xsl:choose>
-        <xsl:when test="@class='monospaced'">
-          <pre class="{name(.)}">
-            <xsl:call-template name="number.rtf.lines">
-              <xsl:with-param name="rtf" select="$rtf"/>
-            </xsl:call-template>
-          </pre>
-        </xsl:when>
-        <xsl:otherwise>
-          <div class="{name(.)}">
-            <xsl:call-template name="number.rtf.lines">
-              <xsl:with-param name="rtf" select="$rtf"/>
-            </xsl:call-template>
-          </div>
-        </xsl:otherwise>
-      </xsl:choose>
+    <xsl:when test="$shade.verbatim != 0 and @class='monospaced'">
+      <table xsl:use-attribute-sets="shade.verbatim.style">
+        <tr>
+          <td>
+            <xsl:copy-of select="$content"/>
+          </td>
+        </tr>
+      </table>
     </xsl:when>
-
     <xsl:otherwise>
-      <xsl:choose>
-        <xsl:when test="@class='monospaced'">
-          <pre class="{name(.)}">
-            <xsl:copy-of select="$rtf"/>
-          </pre>
-        </xsl:when>
-        <xsl:otherwise>
-          <div class="{name(.)}">
-            <xsl:copy-of select="$rtf"/>
-          </div>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:copy-of select="$content"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>