[yelp-xsl] mal2html: "center" style hint for block title and desc
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] mal2html: "center" style hint for block title and desc
- Date: Sat, 16 Mar 2013 19:09:42 +0000 (UTC)
commit df11837694d9ca56e81b016f6bbdb2907b911d13
Author: Shaun McCance <shaunm gnome org>
Date: Sat Mar 16 15:08:20 2013 -0400
mal2html: "center" style hint for block title and desc
https://bugzilla.gnome.org/show_bug.cgi?id=695865
xslt/common/html.xsl | 1 +
xslt/mallard/html/mal2html-block.xsl | 14 ++++++++++++--
xslt/mallard/html/mal2html-ui.xsl | 28 ++++++++++++++++++++--------
3 files changed, 33 insertions(+), 10 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index dda2a09..f990eea 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -716,6 +716,7 @@ div.clear {
height: 0; line-height: 0;
clear: both;
}
+.center { text-align: center; }
div.about {
color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index 1a22b20..1eec1ae 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -193,7 +193,13 @@ in accordance with the Mallard specification on fallback block content.
<!-- = desc = -->
<xsl:template mode="mal2html.block.mode" match="mal:desc">
- <div class="desc">
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>desc</xsl:text>
+ <xsl:if test="contains(concat(' ', @style, ' '), ' center ')">
+ <xsl:text> center</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
<xsl:call-template name="html.lang.attrs"/>
<xsl:apply-templates mode="mal2html.inline.mode"/>
</div>
@@ -565,13 +571,17 @@ in accordance with the Mallard specification on fallback block content.
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
+ <xsl:variable name="style" select="concat(' ', @style, ' ')"/>
<div>
<xsl:attribute name="class">
<xsl:text>title title-</xsl:text>
<xsl:value-of select="local-name(..)"/>
- <xsl:if test="contains(concat(' ', @style, ' '), ' heading ')">
+ <xsl:if test="contains($style, ' heading ')">
<xsl:text> title-heading</xsl:text>
</xsl:if>
+ <xsl:if test="contains($style, ' center ')">
+ <xsl:text> center</xsl:text>
+ </xsl:if>
</xsl:attribute>
<xsl:call-template name="html.lang.attrs"/>
<xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
diff --git a/xslt/mallard/html/mal2html-ui.xsl b/xslt/mallard/html/mal2html-ui.xsl
index dcce2a6..3cf65a3 100644
--- a/xslt/mallard/html/mal2html-ui.xsl
+++ b/xslt/mallard/html/mal2html-ui.xsl
@@ -560,16 +560,28 @@ ${node} element.
</xsl:choose>
<xsl:text>px;</xsl:text>
</xsl:attribute>
- <xsl:if test="$media/uix:thumb/uix:caption/mal:title">
- <span class="title">
- <xsl:apply-templates mode="mal2html.inline.mode"
- select="$media/uix:thumb/uix:caption/mal:title[1]/node()"/>
+ <xsl:variable name="title" select="$media/uix:thumb/uix:caption/mal:title[1]"/>
+ <xsl:if test="$title">
+ <span>
+ <xsl:attribute name="class">
+ <xsl:text>title</xsl:text>
+ <xsl:if test="contains(concat(' ', $title/@style, ' '), ' center ')">
+ <xsl:text> center</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.inline.mode" select="$title/node()"/>
</span>
</xsl:if>
- <xsl:if test="$media/uix:thumb/uix:caption/mal:desc">
- <span class="desc">
- <xsl:apply-templates mode="mal2html.inline.mode"
- select="$media/uix:thumb/uix:caption/mal:desc[1]/node()"/>
+ <xsl:variable name="desc" select="$media/uix:thumb/uix:caption/mal:desc[1]"/>
+ <xsl:if test="$desc">
+ <span>
+ <xsl:attribute name="class">
+ <xsl:text>desc</xsl:text>
+ <xsl:if test="contains(concat(' ', $desc/@style, ' '), ' center ')">
+ <xsl:text> center</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.inline.mode" select="$desc/node()"/>
</span>
</xsl:if>
</span>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]