[yelp-xsl] mallard/html: Experimental ui:expanded support for all titled blocks
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] mallard/html: Experimental ui:expanded support for all titled blocks
- Date: Wed, 15 Jun 2011 03:26:39 +0000 (UTC)
commit e56ce92298e3fb40a5f591a24a64139fadbe69a6
Author: Shaun McCance <shaunm gnome org>
Date: Tue Jun 14 23:30:23 2011 -0400
mallard/html: Experimental ui:expanded support for all titled blocks
xslt/common/html.xsl | 7 +-
xslt/mallard/html/Makefile.am | 1 +
xslt/mallard/html/mal2html-block.xsl | 80 +++++++++--------------
xslt/mallard/html/mal2html-list.xsl | 117 +++++++++++++++++++++++-----------
xslt/mallard/html/mal2html-page.xsl | 1 +
xslt/mallard/html/mal2html-table.xsl | 70 ++++++++++++---------
xslt/mallard/html/mal2html-ui.xsl | 83 ++++++++++++++++++++++++
xslt/mallard/html/mal2xhtml.xsl | 1 +
8 files changed, 241 insertions(+), 119 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 09bae69..00578a6 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -797,7 +797,7 @@ div.figure > div.inner > div.region > div.contents {
background-color: </xsl:text>
<xsl:value-of select="$color.background"/><xsl:text>;
}
-div.list > div.title { margin-bottom: 0.5em; }
+div.list > div.inner > div.title { margin-bottom: 0.5em; }
div.listing > div.inner { margin: 0; padding: 0; }
div.listing > div.inner > div.region > div.desc { font-style: italic; }
div.note {
@@ -864,15 +864,16 @@ blockquote {
margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: </xsl:text>
<xsl:value-of select="$icons.size.quote"/><xsl:text>px;
}
-div.quote > div.inner > div.cite {
+div.quote > div.inner > div.region > div.cite {
margin-top: 0.5em;
margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: </xsl:text>
<xsl:value-of select="$icons.size.quote"/><xsl:text>px;
color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
}
-div.quote > div.inner > div.cite::before {
+div.quote > div.inner > div.region > div.cite::before {
<!-- FIXME: i18n -->
content: '― ';
+ color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
}
div.screen {
background-color: </xsl:text>
diff --git a/xslt/mallard/html/Makefile.am b/xslt/mallard/html/Makefile.am
index 07c2525..891147f 100644
--- a/xslt/mallard/html/Makefile.am
+++ b/xslt/mallard/html/Makefile.am
@@ -9,6 +9,7 @@ xsl_DATA = \
mal2html-page.xsl \
mal2html-svg.xsl \
mal2html-table.xsl \
+ mal2html-ui.xsl \
mal2html.xsl \
mal2xhtml.xsl
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index a871360..c7d32b4 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -202,15 +202,24 @@ in accordance with the Mallard specification on fallback block content.
<xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if = 'true'">
<xsl:if test="$mal2html.editor_mode
or processing-instruction('mal2html.show_comment')">
- <div class="comment">
+ <div>
<xsl:call-template name="html.lang.attrs"/>
+ <xsl:attribute name="class">
+ <xsl:text>comment</xsl:text>
+ <xsl:if test="mal:title and @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 mode="mal2html.block.mode" select="mal:title"/>
- <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
- <div class="contents">
- <xsl:for-each select="*[not(self::mal:title or self::mal:cite)]">
- <xsl:apply-templates mode="mal2html.block.mode" select="."/>
- </xsl:for-each>
+ <div class="region">
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
+ <div class="contents">
+ <xsl:for-each select="*[not(self::mal:title or self::mal:cite)]">
+ <xsl:apply-templates mode="mal2html.block.mode" select="."/>
+ </xsl:for-each>
+ </div>
</div>
</div>
</div>
@@ -390,42 +399,6 @@ in accordance with the Mallard specification on fallback block content.
</xsl:if>
</xsl:template>
-<xsl:template name="mal2html.ui.expander.data">
- <xsl:param name="node" select="."/>
- <xsl:if test="$node/mal:title and ($node/@ui:expanded or $node/self::ui:expander)">
- <xsl:variable name="title_e" select="$node/mal:info/mal:title[ type = 'ui:expanded'][1]"/>
- <xsl:variable name="title_c" select="$node/mal:info/mal:title[ type = 'ui:collapsed'][1]"/>
- <div class="yelp-data yelp-data-ui-expander">
- <xsl:attribute name="dir">
- <xsl:call-template name="l10n.direction"/>
- </xsl:attribute>
- <xsl:attribute name="data-yelp-expanded">
- <xsl:choose>
- <xsl:when test="$node/self::ui:expander/@expanded = 'no'">
- <xsl:text>no</xsl:text>
- </xsl:when>
- <xsl:when test="$node/@ui:expanded = 'no'">
- <xsl:text>no</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>yes</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:if test="$title_e">
- <div class="yelp-title-expanded">
- <xsl:apply-templates mode="mal2html.inline.mode" select="$title_e/node()"/>
- </div>
- </xsl:if>
- <xsl:if test="$title_c">
- <div class="yelp-title-collapsed">
- <xsl:apply-templates mode="mal2html.inline.mode" select="$title_c/node()"/>
- </div>
- </xsl:if>
- </div>
- </xsl:if>
-</xsl:template>
-
<!-- = info = -->
<xsl:template mode="mal2html.block.mode" match="mal:info"/>
@@ -442,16 +415,25 @@ in accordance with the Mallard specification on fallback block content.
<!-- = quote = -->
<xsl:template mode="mal2html.block.mode" match="mal:quote">
<xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if = 'true'">
- <div class="quote">
+ <div>
<xsl:call-template name="html.lang.attrs"/>
+ <xsl:attribute name="class">
+ <xsl:text>quote</xsl:text>
+ <xsl:if test="mal:title and @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 mode="mal2html.block.mode" select="mal:title"/>
- <blockquote class="contents">
- <xsl:for-each select="*[not(self::mal:title or self::mal:cite)]">
- <xsl:apply-templates mode="mal2html.block.mode" select="."/>
- </xsl:for-each>
- </blockquote>
- <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
+ <div class="region">
+ <blockquote class="contents">
+ <xsl:for-each select="*[not(self::mal:title or self::mal:cite)]">
+ <xsl:apply-templates mode="mal2html.block.mode" select="."/>
+ </xsl:for-each>
+ </blockquote>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
+ </div>
</div>
</div>
</xsl:if>
diff --git a/xslt/mallard/html/mal2html-list.xsl b/xslt/mallard/html/mal2html-list.xsl
index e041c0f..4160f77 100644
--- a/xslt/mallard/html/mal2html-list.xsl
+++ b/xslt/mallard/html/mal2html-list.xsl
@@ -18,9 +18,10 @@ 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:str="http://exslt.org/strings"
xmlns="http://www.w3.org/1999/xhtml"
- exclude-result-prefixes="mal str"
+ exclude-result-prefixes="mal ui str"
version="1.0">
<!--!!==========================================================================
@@ -49,23 +50,34 @@ as well as any special processing for child #{item} elements.
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <div class="list">
+ <div>
<xsl:call-template name="html.lang.attrs"/>
- <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
- <xsl:element name="{$el}" namespace="{$html.namespace}">
- <xsl:attribute name="class">
- <xsl:text>list</xsl:text>
- <xsl:if test="contains($style, ' compact ')">
- <xsl:text> compact</xsl:text>
- </xsl:if>
- </xsl:attribute>
- <xsl:if test="@type">
- <xsl:attribute name="style">
- <xsl:value-of select="concat('list-style-type:', @type)"/>
- </xsl:attribute>
+ <xsl:attribute name="class">
+ <xsl:text>list</xsl:text>
+ <xsl:if test="mal:title and @ui:expanded">
+ <xsl:text> ui-expander</xsl:text>
</xsl:if>
- <xsl:apply-templates select="mal:item"/>
- </xsl:element>
+ </xsl:attribute>
+ <xsl:call-template name="mal2html.ui.expander.data"/>
+ <div class="inner">
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="region">
+ <xsl:element name="{$el}" namespace="{$html.namespace}">
+ <xsl:attribute name="class">
+ <xsl:text>list</xsl:text>
+ <xsl:if test="contains($style, ' compact ')">
+ <xsl:text> compact</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:if test="@type">
+ <xsl:attribute name="style">
+ <xsl:value-of select="concat('list-style-type:', @type)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="mal:item"/>
+ </xsl:element>
+ </div>
+ </div>
</div>
</xsl:if>
</xsl:template>
@@ -83,12 +95,23 @@ as well as any special processing for child #{item} elements.
<!-- = steps = -->
<xsl:template mode="mal2html.block.mode" match="mal:steps">
<xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if = 'true'">
- <div class="steps">
+ <div>
<xsl:call-template name="html.lang.attrs"/>
- <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
- <ol class="steps">
- <xsl:apply-templates select="mal:item"/>
- </ol>
+ <xsl:attribute name="class">
+ <xsl:text>steps</xsl:text>
+ <xsl:if test="mal:title and @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 mode="mal2html.block.mode" select="mal:title"/>
+ <div class="region">
+ <ol class="steps">
+ <xsl:apply-templates select="mal:item"/>
+ </ol>
+ </div>
+ </div>
</div>
</xsl:if>
</xsl:template>
@@ -107,18 +130,29 @@ as well as any special processing for child #{item} elements.
<xsl:template mode="mal2html.block.mode" match="mal:terms">
<xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if = 'true'">
<xsl:variable name="style" select="concat(' ', @style, ' ')"/>
- <div class="terms">
+ <div>
<xsl:call-template name="html.lang.attrs"/>
- <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
- <dl class="terms">
- <xsl:attribute name="class">
- <xsl:text>terms</xsl:text>
- <xsl:if test="contains($style, ' compact ')">
- <xsl:text> compact</xsl:text>
- </xsl:if>
- </xsl:attribute>
- <xsl:apply-templates select="mal:item"/>
- </dl>
+ <xsl:attribute name="class">
+ <xsl:text>terms</xsl:text>
+ <xsl:if test="mal:title and @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 mode="mal2html.block.mode" select="mal:title"/>
+ <div class="region">
+ <dl class="terms">
+ <xsl:attribute name="class">
+ <xsl:text>terms</xsl:text>
+ <xsl:if test="contains($style, ' compact ')">
+ <xsl:text> compact</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates select="mal:item"/>
+ </dl>
+ </div>
+ </div>
</div>
</xsl:if>
</xsl:template>
@@ -152,12 +186,21 @@ as well as any special processing for child #{item} elements.
<xsl:if test="$lines">
<xsl:text> tree-lines</xsl:text>
</xsl:if>
+ <xsl:if test="mal:title and @ui:expanded">
+ <xsl:text> ui-expander</xsl:text>
+ </xsl:if>
</xsl:attribute>
- <ul class="tree">
- <xsl:apply-templates mode="mal2html.tree.mode" select="mal:item">
- <xsl:with-param name="lines" select="$lines"/>
- </xsl:apply-templates>
- </ul>
+ <xsl:call-template name="mal2html.ui.expander.data"/>
+ <div class="inner">
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="region">
+ <ul class="tree">
+ <xsl:apply-templates mode="mal2html.tree.mode" select="mal:item">
+ <xsl:with-param name="lines" select="$lines"/>
+ </xsl:apply-templates>
+ </ul>
+ </div>
+ </div>
</div>
</xsl:if>
</xsl:template>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 976a762..adcd74e 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -1320,6 +1320,7 @@ div.comment div.cite {
font-style: italic;
}
+div.tree > div.inner > div.title { margin-bottom: 0.5em; }
ul.tree {
margin: 0; padding: 0;
list-style-type: none;
diff --git a/xslt/mallard/html/mal2html-table.xsl b/xslt/mallard/html/mal2html-table.xsl
index e17b994..8d4aa43 100644
--- a/xslt/mallard/html/mal2html-table.xsl
+++ b/xslt/mallard/html/mal2html-table.xsl
@@ -18,9 +18,10 @@ 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:str="http://exslt.org/strings"
xmlns="http://www.w3.org/1999/xhtml"
- exclude-result-prefixes="mal str"
+ exclude-result-prefixes="mal ui str"
version="1.0">
<!--!!==========================================================================
@@ -169,36 +170,45 @@ REMARK: Describe this module
<xsl:for-each select="str:tokenize(@style)">
<xsl:value-of select="concat(' style-', .)"/>
</xsl:for-each>
- </xsl:attribute>
- <xsl:apply-templates mode="mal2html.block.mode" select="mal:title | mal:desc"/>
- <table class="table">
- <xsl:if test="$style != ''">
- <xsl:attribute name="style">
- <xsl:value-of select="$style"/>
- </xsl:attribute>
+ <xsl:if test="mal:title and @ui:expanded">
+ <xsl:text> ui-expander</xsl:text>
</xsl:if>
- <xsl:apply-templates select="mal:thead">
- <xsl:with-param name="cols" select="$cols"/>
- <xsl:with-param name="rowrules" select="$rowrules"/>
- <xsl:with-param name="colrules" select="$colrules"/>
- <xsl:with-param name="rowshade" select="$rowshade"/>
- <xsl:with-param name="colshade" select="$colshade"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="mal:tfoot">
- <xsl:with-param name="cols" select="$cols"/>
- <xsl:with-param name="rowrules" select="$rowrules"/>
- <xsl:with-param name="colrules" select="$colrules"/>
- <xsl:with-param name="rowshade" select="$rowshade"/>
- <xsl:with-param name="colshade" select="$colshade"/>
- </xsl:apply-templates>
- <xsl:apply-templates select="mal:tr[1] | mal:tbody">
- <xsl:with-param name="cols" select="$cols"/>
- <xsl:with-param name="rowrules" select="$rowrules"/>
- <xsl:with-param name="colrules" select="$colrules"/>
- <xsl:with-param name="rowshade" select="$rowshade"/>
- <xsl:with-param name="colshade" select="$colshade"/>
- </xsl:apply-templates>
- </table>
+ </xsl:attribute>
+ <xsl:call-template name="mal2html.ui.expander.data"/>
+ <div class="inner">
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="region">
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+ <table class="table">
+ <xsl:if test="$style != ''">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$style"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="mal:thead">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="mal:tfoot">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="mal:tr[1] | mal:tbody">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ </table>
+ </div>
+ </div>
</div>
</xsl:if>
</xsl:template>
diff --git a/xslt/mallard/html/mal2html-ui.xsl b/xslt/mallard/html/mal2html-ui.xsl
new file mode 100644
index 0000000..4eac97f
--- /dev/null
+++ b/xslt/mallard/html/mal2html-ui.xsl
@@ -0,0 +1,83 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
+<!--
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; see the file COPYING.LGPL. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+-->
+
+<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="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="mal ui"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - UI Extension
+Support for Mallard UI extension elements.
+
+This stylesheet contains templates to support features from the Mallard UI
+extension.
+-->
+
+
+<!--**==========================================================================
+mal2html.ui.expander.data
+Output data for an expander.
+:Revision:version="1.0" date="2011-06-14" status="final"
+$node: The source element to output data for.
+
+This template outputs an HTML #{div} element with the #{class} attribute set to
+#{"yelp-data yelp-data-ui-expander"}. All #{yelp-data} elements are hidden by
+the CSS. The div contains information about text directionality, the default
+expanded state, and optionally additional titles for the expanded and collapsed
+states.
+-->
+<xsl:template name="mal2html.ui.expander.data">
+ <xsl:param name="node" select="."/>
+ <xsl:if test="$node/mal:title and ($node/@ui:expanded or $node/self::ui:expander)">
+ <xsl:variable name="title_e" select="$node/mal:info/mal:title[ type = 'ui:expanded'][1]"/>
+ <xsl:variable name="title_c" select="$node/mal:info/mal:title[ type = 'ui:collapsed'][1]"/>
+ <div class="yelp-data yelp-data-ui-expander">
+ <xsl:attribute name="dir">
+ <xsl:call-template name="l10n.direction"/>
+ </xsl:attribute>
+ <xsl:attribute name="data-yelp-expanded">
+ <xsl:choose>
+ <xsl:when test="$node/self::ui:expander/@expanded = 'no'">
+ <xsl:text>no</xsl:text>
+ </xsl:when>
+ <xsl:when test="$node/@ui:expanded = 'no'">
+ <xsl:text>no</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>yes</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="$title_e">
+ <div class="yelp-title-expanded">
+ <xsl:apply-templates mode="mal2html.inline.mode" select="$title_e/node()"/>
+ </div>
+ </xsl:if>
+ <xsl:if test="$title_c">
+ <div class="yelp-title-collapsed">
+ <xsl:apply-templates mode="mal2html.inline.mode" select="$title_c/node()"/>
+ </div>
+ </xsl:if>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2xhtml.xsl b/xslt/mallard/html/mal2xhtml.xsl
index 2da9038..dab186c 100644
--- a/xslt/mallard/html/mal2xhtml.xsl
+++ b/xslt/mallard/html/mal2xhtml.xsl
@@ -49,6 +49,7 @@ REMARK: Describe this module
<xsl:include href="mal2html-page.xsl"/>
<xsl:include href="mal2html-svg.xsl"/>
<xsl:include href="mal2html-table.xsl"/>
+<xsl:include href="mal2html-ui.xsl"/>
</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]