[yelp-xsl] Dropping the dual-output for HTML5. Too much maintenance work.



commit ed62198626068c5bb8de867216539ea274f9a193
Author: Shaun McCance <shaunm gnome org>
Date:   Tue May 25 09:51:04 2010 -0500

    Dropping the dual-output for HTML5. Too much maintenance work.

 xslt/common/html.xsl                |  174 +++-------------------------------
 xslt/mallard/html/mal2html-page.xsl |   42 +++++---
 2 files changed, 42 insertions(+), 174 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index c87b7fb..df5359b 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -46,7 +46,6 @@ FIXME
   </xsl:choose>
 </xsl:param>
 
-<xsl:param name="html.html5" select="false()"/>
 <xsl:param name="html.xhtml" select="true()"/>
 
 <xsl:param name="html.namespace">
@@ -90,21 +89,9 @@ FIXME
     </xsl:choose>
   </xsl:param>
   <exsl:document href="{$href}">
-    <xsl:choose>
-      <xsl:when test="$html.html5">
-        <xsl:call-template name="html.page">
-          <xsl:with-param name="node" select="$node"/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:variable name="contents">
-          <xsl:call-template name="html.page">
-            <xsl:with-param name="node" select="$node"/>
-          </xsl:call-template>
-        </xsl:variable>
-        <xsl:apply-templates mode="html.compat.mode" select="exsl:node-set($contents)/*"/>
-      </xsl:otherwise>
-    </xsl:choose>
+    <xsl:call-template name="html.page">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
   </exsl:document>
 </xsl:template>
 
@@ -119,15 +106,15 @@ FIXME
       <xsl:call-template name="html.head.custom"/>
     </head>
     <body>
-      <header>
+      <div class="header">
         <xsl:apply-templates mode="html.header.mode" select="$node"/>
-      </header>
-      <article>
+      </div>
+      <div class="body">
         <xsl:apply-templates mode="html.body.mode" select="$node"/>
-      </article>
-      <footer>
+      </div>
+      <div class="footer">
         <xsl:apply-templates mode="html.footer.mode" select="$node"/>
-      </footer>
+      </div>
     </body>
   </html>
 </xsl:template>
@@ -191,56 +178,6 @@ FIXME
       <xsl:with-param name="direction" select="$direction"/>
     </xsl:call-template>
   </xsl:param>
-  <xsl:variable name="header">
-    <xsl:choose>
-      <xsl:when test="$html.html5">
-        <xsl:text>header</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>div.header</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-  <xsl:variable name="footer">
-    <xsl:choose>
-      <xsl:when test="$html.html5">
-        <xsl:text>footer</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>div.footer</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-  <xsl:variable name="article">
-    <xsl:choose>
-      <xsl:when test="$html.html5">
-        <xsl:text>article</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>div.body</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-  <xsl:variable name="section">
-    <xsl:choose>
-      <xsl:when test="$html.html5">
-        <xsl:text>section</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>div.sect</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-  <xsl:variable name="hgroup">
-    <xsl:choose>
-      <xsl:when test="$html.html5">
-        <xsl:text>hgroup</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>div.hgroup</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
   <xsl:text>
 html { height: 100%; }
 body {
@@ -255,7 +192,7 @@ body {
   max-width: 73em;
   position: relative;
 }
-</xsl:text><xsl:value-of select="$article"/><xsl:text> {
+div.body {
   margin: 0;
   padding: 1em;
   max-width: 60em;
@@ -265,17 +202,17 @@ body {
   border: solid 1px </xsl:text>
     <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
 }
-</xsl:text><xsl:value-of select="$header"/><xsl:text> {
+div.header {
   max-width: 60em;
 }
-</xsl:text><xsl:value-of select="$footer"/><xsl:text> {
+div.footer {
   max-width: 60em;
 }
-</xsl:text><xsl:value-of select="$section"/><xsl:text> {
+div.sect {
   margin-top: 1.72em;
   clear: both;
 }
-</xsl:text><xsl:value-of select="concat($section, ' ', $section)"/><xsl:text>
+div.sect div.sect {
   margin-top: 1.44em;
   margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.72em;
 }
@@ -289,7 +226,7 @@ div.trail {
     <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
 }
 a.trail { white-space: nowrap; }
-</xsl:text><xsl:value-of select="$hgroup"/><xsl:text> {
+div.hgroup {
   margin: 0 0 0.5em 0;
   color: </xsl:text>
     <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
@@ -301,26 +238,11 @@ h1, h2, h3, h4, h5, h6, h7 {
   color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
   font-weight: bold;
 }
-</xsl:text>
-<xsl:choose>
-<xsl:when test="$html.html5">
-<xsl:text>
-h1.title { font-size: 1.44em; }
-h2.subtitle { font-size: 1.2em; }
-section h1.title { font-size: 1.2em; }
-section h2.subtitle { font-size: 1.0em; }
-</xsl:text>
-</xsl:when>
-<xsl:otherwise>
-<xsl:text>
 h1 { font-size: 1.44em; }
 h2 { font-size: 1.2em; }
 h3.title, h4.title, h5.title, h6.title, h7.title { font-size: 1.2em; }
 h3, h4, h5, h6, h7 { font-size: 1em; }
-</xsl:text>
-</xsl:otherwise>
-</xsl:choose>
-<xsl:text>
+
 p { line-height: 1.72em; }
 div, pre, p { margin: 1em 0 0 0; padding: 0; }
 div:first-child, pre:first-child, p:first-child { margin-top: 0; }
@@ -654,68 +576,4 @@ template to provide additional CSS that will be used by all HTML output.
   </xsl:param>
 </xsl:template>
 
-<!-- == html.compat.mode == -->
-
-<xsl:template mode="html.compat.mode" match="article | html:article">
-  <div class="body">
-    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </div>
-</xsl:template>
-
-<xsl:template mode="html.compat.mode" match="header | html:header">
-  <div class="header">
-    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </div>
-</xsl:template>
-
-<xsl:template mode="html.compat.mode" match="section | html:section">
-  <div class="sect">
-    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </div>
-</xsl:template>
-
-<xsl:template mode="html.compat.mode" match="footer | html:footer">
-  <div class="footer">
-    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </div>
-</xsl:template>
-
-<xsl:template mode="html.compat.mode" match="hgroup | html:hgroup">
-  <div class="hgroup">
-    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </div>
-</xsl:template>
-
-<xsl:template mode="html.compat.mode" match="h1 | html:h1">
-  <xsl:variable name="depth">
-    <xsl:value-of select="count(ancestor::section | ancestor::html:section)"/>
-  </xsl:variable>
-  <xsl:element name="h{$depth + 1}" namespace="{$html.namespace}">
-    <xsl:copy-of select="@*"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </xsl:element>
-</xsl:template>
-
-<xsl:template mode="html.compat.mode" match="h2 | html:h2">
-  <xsl:variable name="depth">
-    <xsl:value-of select="count(ancestor::section | ancestor::html:section)"/>
-  </xsl:variable>
-  <xsl:element name="h{$depth + 2}" namespace="{$html.namespace}">
-    <xsl:copy-of select="@*"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </xsl:element>
-</xsl:template>
-
-<xsl:template mode="html.compat.mode" match="*">
-  <xsl:copy>
-    <xsl:copy-of select="@*"/>
-    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
-  </xsl:copy>
-</xsl:template>
-
 </xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 4b117bb..bd85a30 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -257,14 +257,14 @@ REMARK: Describe this template
   </xsl:variable>
   <xsl:variable name="seealsonodes" select="exsl:node-set($seealsolinks)/*"/>
   <xsl:if test="$guidenodes or $seealsonodes">
-    <section class="autolinks">
-      <hgroup>
-        <h1 class="title">
+    <div class="sect sect-links">
+      <div class="hgroup">
+        <xsl:element name="{concat('h', $depth)}" namespace="{$html.namespace}">
           <xsl:call-template name="l10n.gettext">
             <xsl:with-param name="msgid" select="'Further Reading'"/>
           </xsl:call-template>
-        </h1>
-      </hgroup>
+        </xsl:element>
+      </div>
       <!-- FIXME: For prev/next series, insert links to first/prev/next/last -->
       <div class="autolinks">
         <xsl:if test="$guidenodes">
@@ -300,7 +300,7 @@ REMARK: Describe this template
           </ul>
         </xsl:if>
       </div>
-    </section>
+    </div>
   </xsl:if>
 </xsl:template>
 
@@ -558,10 +558,10 @@ REMARK: Describe this template
 <xsl:template mode="html.body.mode" match="mal:page">
   <xsl:call-template name="mal2html.page.prevnextlinks"/>
   <xsl:call-template name="mal2html.page.versionbanner"/>
-  <hgroup>
+  <div class="hgroup">
     <xsl:apply-templates mode="mal2html.title.mode" select="mal:title"/>
     <xsl:apply-templates mode="mal2html.title.mode" select="mal:subtitle"/>
-  </hgroup>
+  </div>
   <div class="inner">
     <xsl:for-each
         select="*[not(self::mal:section or self::mal:title or self::mal:subtitle)]">
@@ -579,11 +579,11 @@ REMARK: Describe this template
 
 <!-- = section = -->
 <xsl:template match="mal:section">
-  <section id="{ id}">
-    <hgroup>
+  <div class="sect" id="{ id}">
+    <div class="hgroup">
       <xsl:apply-templates mode="mal2html.title.mode" select="mal:title"/>
       <xsl:apply-templates mode="mal2html.title.mode" select="mal:subtitle"/>
-    </hgroup>
+    </div>
     <div class="inner">
       <xsl:for-each
           select="*[not(self::mal:section or self::mal:title or self::mal:subtitle)]">
@@ -597,7 +597,7 @@ REMARK: Describe this template
     <xsl:call-template name="mal2html.page.autolinks">
       <xsl:with-param name="node" select="."/>
     </xsl:call-template>
-  </section>
+  </div>
 </xsl:template>
 
 
@@ -609,16 +609,26 @@ FIXE
 -->
 <!-- = subtitle = -->
 <xsl:template mode="mal2html.title.mode" match="mal:subtitle">
-  <h2 class="subtitle">
+  <xsl:variable name="depth"
+                select="count(ancestor::mal:section) + 2"/>
+  <xsl:element name="{concat('h', $depth)}" namespace="{$html.namespace}">
+    <xsl:attribute name="class">
+      <xsl:text>title</xsl:text>
+    </xsl:attribute>
     <xsl:apply-templates mode="mal2html.inline.mode"/>
-  </h2>
+  </xsl:element>
 </xsl:template>
 
 <!-- = title = -->
 <xsl:template mode="mal2html.title.mode" match="mal:title">
-  <h1 class="title">
+  <xsl:variable name="depth"
+                select="count(ancestor::mal:section) + 1"/>
+  <xsl:element name="{concat('h', $depth)}" namespace="{$html.namespace}">
+    <xsl:attribute name="class">
+      <xsl:text>title</xsl:text>
+    </xsl:attribute>
     <xsl:apply-templates mode="mal2html.inline.mode"/>
-  </h1>
+  </xsl:element>
 </xsl:template>
 
 </xsl:stylesheet>



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