[yelp-xsl] mal2html-block: Handle unknown blocks like divs, per MEP-0005



commit feea0fda5e430968027520e15840f4bb57fc7a80
Author: Shaun McCance <shaunm gnome org>
Date:   Mon Feb 29 18:59:31 2016 -0500

    mal2html-block: Handle unknown blocks like divs, per MEP-0005

 xslt/common/html.xsl                 |    1 +
 xslt/mallard/html/mal2html-block.xsl |   35 +++++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 9629821..ed84bc1 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -1316,6 +1316,7 @@ div.synopsis div.code {
   padding: 0;
 }
 div.synopsis div.code > pre.contents { margin: 0; padding: 0; }
+div.unknown > div.inner > div.region > div.desc { font-style: italic; }
 div.table > div.desc { font-style: italic; }
 tr.shade {
   background-color: </xsl:text><xsl:value-of select="$color.gray_background"/><xsl:text>;
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index 11d25d5..a703268 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -136,9 +136,38 @@ in accordance with the Mallard specification on fallback block content.
       <xsl:text>Unmatched block element: </xsl:text>
       <xsl:value-of select="local-name(.)"/>
     </xsl:message>
-    <xsl:apply-templates mode="mal2html.block.mode">
-      <xsl:with-param name="restricted" select="true()"/>
-    </xsl:apply-templates>
+    <xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable>
+    <xsl:if test="$if != ''">
+      <div>
+        <xsl:call-template name="html.lang.attrs"/>
+        <xsl:call-template name="html.class.attr">
+          <xsl:with-param name="class">
+            <xsl:text>unknown</xsl:text>
+            <xsl:if test="mal:title and @ui:expanded">
+              <xsl:text> ui-expander</xsl:text>
+            </xsl:if>
+            <xsl:if test="$if != 'true'">
+              <xsl:text> if-if </xsl:text>
+              <xsl:value-of select="$if"/>
+            </xsl:if>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:call-template name="mal2html.ui.expander.data"/>
+        <div class="inner">
+          <xsl:apply-templates mode="mal2html.block.mode" select="mal:title[1]"/>
+          <div class="region">
+            <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc[1]"/>
+            <div class="contents">
+              <xsl:for-each select="*[not(self::mal:title or self::mal:desc)]">
+                <xsl:apply-templates mode="mal2html.block.mode" select=".">
+                  <xsl:with-param name="restricted" select="true()"/>
+                </xsl:apply-templates>
+              </xsl:for-each>
+            </div>
+          </div>
+        </div>
+      </div>
+    </xsl:if>
   </xsl:if>
 </xsl:template>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]