[yelp-xsl] mal2html-page: Support for ui:expanded on sections



commit 39818e335ed9048c84f6b6709e2c5baba82f25d5
Author: Shaun McCance <shaunm gnome org>
Date:   Thu Jun 16 13:52:35 2011 -0400

    mal2html-page: Support for ui:expanded on sections

 xslt/common/html.xsl                |   28 +++++++++++++++++++++++-----
 xslt/mallard/html/mal2html-page.xsl |   32 ++++++++++++++++++++++++--------
 2 files changed, 47 insertions(+), 13 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index fb60823..4be73cb 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -1048,10 +1048,15 @@ div.media-ttml-p {
     <xsl:value-of select="$color.gray_border"/><xsl:text>;
 }
 div.yelp-data { display: none; }
-div.ui-expander > div.inner > div.title:hover {
+div.ui-expander > div.inner > div.title:hover,
+div.ui-expander > div.inner > div.hgroup:hover * {
   color: </xsl:text><xsl:value-of select="$color.link"/><xsl:text>;
 }
-div.ui-expander-e > div.inner > div.title span.ui-expander-arrow-ltr {
+div.ui-expander > div.inner > div.hgroup > .subtitle {
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.44em;
+}
+div.ui-expander-e > div.inner > div.title span.ui-expander-arrow-ltr,
+div.ui-expander-e > div.inner > div.hgroup span.ui-expander-arrow-ltr {
   display: inline-block; <!-- webkit needs this to rotate -->
   -moz-transform: rotate(90deg);
   -webkit-transform: rotate(90deg);
@@ -1059,7 +1064,8 @@ div.ui-expander-e > div.inner > div.title span.ui-expander-arrow-ltr {
   -ms-transform: rotate(90deg);
   transform: rotate(90deg);
 }
-div.ui-expander-e > div.inner > div.title span.ui-expander-arrow-rtl {
+div.ui-expander-e > div.inner > div.title span.ui-expander-arrow-rtl,
+div.ui-expander-e > div.inner > div.hgroup span.ui-expander-arrow-rtl {
   display: inline-block; <!-- webkit needs this to rotate -->
   -moz-transform: rotate(-90deg);
   -webkit-transform: rotate(-90deg);
@@ -1484,10 +1490,22 @@ $(document).ready(function () {
       arrow = $('<span class="ui-expander-arrow-ltr">â</span>');
     var region = expander.children('.inner').children('.region');
     var title = expander.children('.inner').children('.title');
+    var issect = false;
+    if (title.length == 0) {
+      title = expander.children('.inner').children('.hgroup');
+      issect = true;
+    }
+    if (title.length == 0) {
+      return;
+    }
     var titlespan = title.find('span.title:first');
     var titlebase = titlespan.html();
     title.attr('role', 'button').attr('aria-controls', region.attr('id'));
-    title.children().append('&#x00A0;&#x00A0;').append(arrow);
+    if (issect) {
+      title.children('.title').prepend('&#x00A0;&#x00A0;').prepend(arrow);
+    } else {
+      title.children().append('&#x00A0;&#x00A0;').append(arrow);
+    }
     var title_e = yelpdata.children('div.yelp-title-expanded');
     var title_c = yelpdata.children('div.yelp-title-collapsed');
     if (yelpdata.attr('data-yelp-expanded') == 'no') {
@@ -1501,7 +1519,7 @@ $(document).ready(function () {
       if (title_e.length != 0)
         titlespan.html(title_e.html());
     }
-    expander.children('.inner').children('.title').click(function () {
+    title.click(function () {
       var compfunc = function () { return true; };
       if (expander.is('div.figure'))
         compfunc = function () { expander.yelp_auto_resize(); };
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 50b703f..c590995 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -18,10 +18,11 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 xmlns:mal="http://projectmallard.org/1.0/";
+                xmlns:ui="http://projectmallard.org/experimental/ui/";
                 xmlns:e="http://projectmallard.org/experimental/";
                 xmlns:exsl="http://exslt.org/common";
                 xmlns="http://www.w3.org/1999/xhtml";
-                exclude-result-prefixes="mal e exsl"
+                exclude-result-prefixes="mal ui e exsl"
                 version="1.0">
 
 <!--!!==========================================================================
@@ -338,8 +339,17 @@ REMARK: Describe this template
 
 <!-- = section = -->
 <xsl:template mode="mal2html.section.mode" match="mal:section">
-  <div class="sect" id="{ id}">
-    <xsl:apply-templates select="."/>
+  <div id="{ id}">
+    <xsl:attribute name="class">
+      <xsl:text>sect</xsl:text>
+      <xsl:if test="@ui:expanded">
+        <xsl:text> ui-expander</xsl:text>
+      </xsl:if>
+    </xsl:attribute>
+    <xsl:call-template name="mal2html.ui.expander.data"/>
+    <div class="inner">
+      <xsl:apply-templates select="."/>
+    </div>
   </div>
 </xsl:template>
 
@@ -381,6 +391,7 @@ REMARK: Describe this template
     <xsl:apply-templates mode="mal2html.title.mode" select="mal:title"/>
     <xsl:apply-templates mode="mal2html.title.mode" select="mal:subtitle"/>
   </div>
+  <div class="region">
   <div class="contents">
     <xsl:if test="$type = 'facets'">
       <xsl:call-template name="mal2html.facets.controls"/>
@@ -468,9 +479,11 @@ REMARK: Describe this template
           </xsl:choose>
         </xsl:variable>
         <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>
+          <span class="title">
+            <xsl:call-template name="l10n.gettext">
+              <xsl:with-param name="msgid" select="'Further Reading'"/>
+            </xsl:call-template>
+          </span>
         </xsl:element>
       </div>
       <div class="contents">
@@ -526,6 +539,7 @@ REMARK: Describe this template
       </div>
     </div>
   </xsl:if>
+  </div>
 </xsl:template>
 
 
@@ -551,7 +565,7 @@ FIXME
   </xsl:variable>
   <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
     <xsl:attribute name="class">
-      <xsl:text>title</xsl:text>
+      <xsl:text>subtitle</xsl:text>
     </xsl:attribute>
     <xsl:apply-templates mode="mal2html.inline.mode"/>
   </xsl:element>
@@ -575,7 +589,9 @@ FIXME
     <xsl:attribute name="class">
       <xsl:text>title</xsl:text>
     </xsl:attribute>
-    <xsl:apply-templates mode="mal2html.inline.mode"/>
+    <span class="title">
+      <xsl:apply-templates mode="mal2html.inline.mode"/>
+    </span>
   </xsl:element>
 </xsl:template>
 



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