[yelp-xsl] mal2html-lit: Implement style="continues" for list and steps
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] mal2html-lit: Implement style="continues" for list and steps
- Date: Fri, 14 Dec 2012 15:17:21 +0000 (UTC)
commit a542c57cc7edd522ec6f301780cbcd502c113c63
Author: Shaun McCance <shaunm gnome org>
Date: Fri Dec 14 10:16:44 2012 -0500
mal2html-lit: Implement style="continues" for list and steps
xslt/mallard/html/mal2html-list.xsl | 36 +++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/xslt/mallard/html/mal2html-list.xsl b/xslt/mallard/html/mal2html-list.xsl
index e46be82..0904640 100644
--- a/xslt/mallard/html/mal2html-list.xsl
+++ b/xslt/mallard/html/mal2html-list.xsl
@@ -79,6 +79,11 @@ as well as any special processing for child #{item} elements.
<xsl:value-of select="concat('list-style-type:', @type)"/>
</xsl:attribute>
</xsl:if>
+ <xsl:if test="contains(concat(' ', @style, ' '), ' continues ')">
+ <xsl:attribute name="start">
+ <xsl:call-template name="mal.list.start"/>
+ </xsl:attribute>
+ </xsl:if>
<xsl:apply-templates select="mal:item"/>
</xsl:element>
</div>
@@ -124,6 +129,11 @@ as well as any special processing for child #{item} elements.
<xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
<div class="region">
<ol class="steps">
+ <xsl:if test="contains(concat(' ', @style, ' '), ' continues ')">
+ <xsl:attribute name="start">
+ <xsl:call-template name="mal.list.start"/>
+ </xsl:attribute>
+ </xsl:if>
<xsl:apply-templates select="mal:item"/>
</ol>
</div>
@@ -132,6 +142,32 @@ as well as any special processing for child #{item} elements.
</xsl:if>
</xsl:template>
+<xsl:template name="mal.list.start">
+ <xsl:param name="node" select="."/>
+ <xsl:choose>
+ <xsl:when test="contains(concat(' ', $node/@style, ' '), ' continues ')">
+ <xsl:variable name="prevlist"
+ select="$node/preceding::*[name(.) = name($node)]
+ [not(@type) and not($node/@type) or (@type = $node/@type)][1]"/>
+ <xsl:choose>
+ <xsl:when test="count($prevlist) = 0">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="prevlength" select="count($prevlist/mal:item)"/>
+ <xsl:variable name="prevstart">
+ <xsl:call-template name="mal.list.start">
+ <xsl:with-param name="node" select="$prevlist"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$prevstart + $prevlength"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<!-- = steps/item = -->
<xsl:template match="mal:steps/mal:item">
<xsl:variable name="if"><xsl:call-template name="mal.if.test"/></xsl:variable><xsl:if test="$if != ''">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]