]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/content/help.xsl
Import 1.0rc1 supporting Firefox up to 11.*
[dactyl.git] / common / content / help.xsl
index a93f9a7a8f6fe96c6a299e3466f3a56acc4e6799..f1dfce9eb684486e2879cbd3c22d37dbc29b56f6 100644 (file)
@@ -95,6 +95,7 @@
     <xsl:template match="@*|node()" mode="overlay">
         <xsl:apply-templates select="." mode="overlay-2"/>
     </xsl:template>
+    <xsl:template match="@*[starts-with(local-name(), 'on')]|*[local-name() = 'script']" mode="overlay-2"/>
     <xsl:template match="@*|node()" mode="overlay-2">
         <xsl:copy>
             <xsl:apply-templates select="@*|node()" mode="overlay"/>
     <xsl:template match="dactyl:default[not(@type='plain')]" mode="help-2">
         <xsl:variable name="type" select="preceding-sibling::dactyl:type[1] | following-sibling::dactyl:type[1]"/>
         <span dactyl:highlight="HelpDefault">
-            <xsl:copy-of select="@*"/>
+            <xsl:copy-of select="@*[not(starts-with(local-name(), 'on'))]"/>
             <xsl:text>(default: </xsl:text>
             <xsl:choose>
                 <xsl:when test="$type = 'string'">
     <xsl:template name="linkify-tag">
         <xsl:param name="contents" select="text()"/>
         <xsl:variable name="tag" select="$contents"/>
+        <xsl:variable name="tag-url" select="
+          regexp:replace(regexp:replace($tag, '%', 'g', '%25'),
+                         '#', 'g', '%23')"/>
+
         <a style="color: inherit;">
             <xsl:if test="not(@link) or @link != 'false'">
                 <xsl:choose>
+                    <xsl:when test="@link and @link != 'false'">
+                        <xsl:attribute name="href">dactyl://help-tag/<xsl:value-of select="@link"/></xsl:attribute>
+                    </xsl:when>
                     <xsl:when test="contains(ancestor::*/@document-tags, concat(' ', $tag, ' '))">
-                        <xsl:attribute name="href">#<xsl:value-of select="$tag"/></xsl:attribute>
+                        <xsl:attribute name="href">#<xsl:value-of select="$tag-url"/></xsl:attribute>
                     </xsl:when>
                     <xsl:otherwise>
-                        <xsl:attribute name="href">dactyl://help-tag/<xsl:value-of select="$tag"/></xsl:attribute>
+                        <xsl:attribute name="href">dactyl://help-tag/<xsl:value-of select="$tag-url"/></xsl:attribute>
                     </xsl:otherwise>
                 </xsl:choose>
             </xsl:if>
                     <xsl:when test="@op and @op != ''"><xsl:value-of select="@op"/></xsl:when>
                     <xsl:otherwise>=</xsl:otherwise>
                 </xsl:choose>
-                <xsl:copy-of select="@*|node()"/>
+                <xsl:copy-of select="@*[not(starts-with(local-name(), 'on'))]|node()[local-name() != 'script']"/>
             </html:span>
         </xsl:variable>
         <xsl:apply-templates select="exsl:node-set($nodes)" mode="help-1"/>
         <xsl:variable name="nodes">
             <code xmlns="&xmlns.dactyl;">
                 <se opt="{@opt}" op="{@op}" link="{@link}">
-                    <xsl:copy-of select="@*|node()"/>
+                    <xsl:copy-of select="@*[not(starts-with(local-name(), 'on'))]|node()[local-name() != 'script']"/>
                 </se>
             </code>
         </xsl:variable>
     </xsl:template>
     <xsl:template match="dactyl:xml-block" mode="help-2">
         <div dactyl:highlight="HelpXMLBlock">
-            <xsl:call-template name="xml-highlight"/>
+            <xsl:apply-templates mode="xml-highlight"/>
         </div>
     </xsl:template>
     <xsl:template match="dactyl:xml-highlight" mode="help-2">
-        <xsl:call-template name="xml-highlight"/>
+        <div dactyl:highlight="HelpXMLBlock">
+            <xsl:apply-templates mode="xml-highlight"/>
+        </div>
     </xsl:template>
 
+
     <!-- Plugins {{{1 -->
 
     <xsl:template name="info">
 
     <!-- Process Tree {{{1 -->
 
+    <xsl:template match="@*[starts-with(local-name(), 'on')]|*[local-name() = 'script']" mode="help-2"/>
     <xsl:template match="@*|node()" mode="help-2">
         <xsl:copy>
             <xsl:apply-templates select="@*|node()" mode="help-1"/>
     </xsl:template>
 
     <!-- XML Highlighting (xsl:import doesn't work in Firefox 3.x) {{{1 -->
-    <xsl:template name="xml-highlight">
-        <div dactyl:highlight="HelpXML">
-            <xsl:apply-templates mode="xml-highlight"/>
-        </div>
-    </xsl:template>
-
     <xsl:template name="xml-namespace">
         <xsl:param name="node" select="."/>
         <xsl:if test="name($node) != local-name($node)">