[gnome-doc-utils/mallard] [mal2html] Improved block mode processing and fixed guide link issue



commit c85366f7e4f5a1703daa099df32f605684745b2f
Author: Shaun McCance <shaunm gnome org>
Date:   Wed May 6 11:07:50 2009 -0500

    [mal2html] Improved block mode processing and fixed guide link issue
---
 xslt/mallard/html/mal2html-block.xsl |   45 +++++++++++++++++++--------------
 xslt/mallard/html/mal2html-css.xsl   |    2 +-
 xslt/mallard/html/mal2html-page.xsl  |   41 +++++++++++++++----------------
 3 files changed, 47 insertions(+), 41 deletions(-)

diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index 287faa3..e89122e 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -203,21 +203,24 @@ FIXME
 <!-- = comment = -->
 <xsl:template mode="mal2html.block.mode" match="mal:comment">
   <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
-  <div>
-    <xsl:attribute name="class">
-      <xsl:text>comment</xsl:text>
-      <xsl:if test="$first_child">
-        <xsl:text> first-child</xsl:text>
-      </xsl:if>
-    </xsl:attribute>
-    <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
-    <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
-    <xsl:for-each select="mal:*[not(self::mal:title or self::mal:cite)]">
-      <xsl:apply-templates mode="mal2html.block.mode" select=".">
-        <xsl:with-param name="first_child" select="position() = 1"/>
-      </xsl:apply-templates>
-    </xsl:for-each>
-  </div>
+  <xsl:if test="$mal2html.editor_mode">
+    <div>
+      <xsl:attribute name="class">
+        <xsl:text>comment</xsl:text>
+        <xsl:if test="$first_child">
+          <xsl:text> first-child</xsl:text>
+        </xsl:if>
+      </xsl:attribute>
+      <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+      <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
+      <xsl:for-each select="mal:*[not(self::mal:title or self::mal:cite)
+                            and not($mal2html.editor_mode and self::mal:comment)]">
+        <xsl:apply-templates mode="mal2html.block.mode" select=".">
+          <xsl:with-param name="first_child" select="position() = 1"/>
+        </xsl:apply-templates>
+      </xsl:for-each>
+    </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = comment/cite = -->
@@ -249,7 +252,7 @@ FIXME
         <xsl:text> first-child</xsl:text>
       </xsl:if>
     </xsl:attribute>
-    <xsl:for-each select="mal:*">
+    <xsl:for-each select="mal:*[not($mal2html.editor_mode and self::mal:comment)]">
       <xsl:apply-templates mode="mal2html.block.mode" select=".">
         <xsl:with-param name="first_child" select="position() = 1"/>
       </xsl:apply-templates>
@@ -269,7 +272,8 @@ FIXME
     </xsl:attribute>
     <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
     <div class="figure-contents">
-      <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)]">
+      <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)
+                            and not($mal2html.editor_mode and self::mal:comment)]">
         <xsl:apply-templates mode="mal2html.block.mode" select=".">
           <xsl:with-param name="first_child" select="position() = 1"/>
         </xsl:apply-templates>
@@ -292,7 +296,8 @@ FIXME
     <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
     <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
     <div class="listing-contents">
-      <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)]">
+      <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)
+                            and not($mal2html.editor_mode and self::mal:comment)]">
         <xsl:apply-templates mode="mal2html.block.mode" select=".">
           <xsl:with-param name="first_child" select="position() = 1"/>
         </xsl:apply-templates>
@@ -339,7 +344,8 @@ FIXME
     <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
     <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
     <div class="synopsis-contents">
-      <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)]">
+      <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)
+                            and not($mal2html.editor_mode and self::mal:comment)]">
         <xsl:apply-templates mode="mal2html.block.mode" select=".">
           <xsl:with-param name="first_child" select="position() = 1"/>
         </xsl:apply-templates>
@@ -348,6 +354,7 @@ FIXME
   </div>
 </xsl:template>
 
+<!-- = title = -->
 <xsl:template mode="mal2html.block.mode" match="mal:title">
   <div class="title title-{local-name(..)}">
     <xsl:apply-templates mode="mal2html.inline.mode"/>
diff --git a/xslt/mallard/html/mal2html-css.xsl b/xslt/mallard/html/mal2html-css.xsl
index f444b26..e33d48d 100644
--- a/xslt/mallard/html/mal2html-css.xsl
+++ b/xslt/mallard/html/mal2html-css.xsl
@@ -144,7 +144,7 @@ div.copyrights {
   </xsl:call-template>
   <xsl:text>;
 }
-div.section { margin-top: 2em; clear: both; }
+div.section { margin-top: 2.4em; clear: both; }
 div.section div.section { margin-top: 1.72em; margin-left: 1.72em; }
 div.section div.section div.section { margin-top: 1.44em; }
 div.header {
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 55baf64..c4ac9f1 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -28,6 +28,9 @@ REMARK: Describe this module
 -->
 
 
+<xsl:param name="mal2html.editor_mode" select="false()"/>
+
+
 <!--**==========================================================================
 mal2html.page.copyright
 Outputs the copyright notice at the bottom of a page
@@ -181,7 +184,7 @@ REMARK: Describe this template
           <xsl:with-param name="xref" select="$target/@id"/>
         </xsl:call-template>
 
-        <xsl:if test="true()">
+        <xsl:if test="$mal2html.editor_mode">
           <xsl:variable name="page" select="$target/ancestor-or-self::mal:page[1]"/>
           <xsl:variable name="date">
             <xsl:for-each select="$page/mal:info/mal:version">
@@ -327,18 +330,7 @@ REMARK: Describe this template
 -->
 <xsl:template name="mal2html.page.autolink">
   <xsl:param name="page"/>
-  <xsl:param name="xref">
-    <xsl:choose>
-      <xsl:when test="$page/self::mal:section">
-        <xsl:value-of select="$page/ancestor::mal:page[1]/@id"/>
-        <xsl:text>#</xsl:text>
-        <xsl:value-of select="$page/@id"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="$page/@id"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:param>
+  <xsl:param name="xref" select="$page/@id"/>
   <li class="autolink">
     <a>
       <xsl:attribute name="href">
@@ -387,8 +379,7 @@ REMARK: Describe this template
       <xsl:call-template name="mal2html.css"/>
     </head>
     <body>
-      <!-- FIXME: only in editor mode -->
-      <xsl:if test="$version/@status != ''">
+      <xsl:if test="$mal2html.editor_mode and $version/@status != ''">
         <xsl:attribute name="class">
           <xsl:value-of select="concat(' status-', $version/@status)"/>
         </xsl:attribute>
@@ -439,9 +430,13 @@ REMARK: Describe this template
                          select="mal:title | mal:subtitle"/>
   </div>
   <div class="contents">
-    <xsl:apply-templates
-        mode="mal2html.block.mode"
-        select="*[not(self::mal:section | self::mal:title | self::mal:subtitle)]"/>
+    <xsl:for-each
+        select="mal:*[not(self::mal:section or self::mal:title or self::mal:subtitle)
+                and not($mal2html.editor_mode and self::mal:comment)]">
+      <xsl:apply-templates mode="mal2html.block.mode" select=".">
+        <xsl:with-param name="first_child" select="position() = 1"/>
+      </xsl:apply-templates>
+    </xsl:for-each>
     <xsl:if test="@type = 'guide'">
       <xsl:call-template name="mal2html.page.pagelinks"/>
     </xsl:if>
@@ -460,9 +455,13 @@ REMARK: Describe this template
                            select="mal:title | mal:subtitle"/>
     </div>
     <div class="contents">
-      <xsl:apply-templates
-          mode="mal2html.block.mode"
-          select="*[not(self::mal:section | self::mal:title | self::mal:subtitle)]"/>
+      <xsl:for-each
+          select="mal:*[not(self::mal:section or self::mal:title or self::mal:subtitle)
+                  and not($mal2html.editor_mode and self::mal:comment)]">
+        <xsl:apply-templates mode="mal2html.block.mode" select=".">
+          <xsl:with-param name="first_child" select="position() = 1"/>
+        </xsl:apply-templates>
+      </xsl:for-each>
       <xsl:if test="/mal:page/@type = 'guide'">
         <xsl:call-template name="mal2html.page.pagelinks"/>
       </xsl:if>



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