[yelp-xsl] mal2html-links: Add support for links/@depth attribute
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] mal2html-links: Add support for links/@depth attribute
- Date: Mon, 20 Aug 2012 16:48:49 +0000 (UTC)
commit 23bc5c4bb2fdeb8ebe30e44fc8fc4dd93a11ad04
Author: Shaun McCance <shaunm gnome org>
Date: Mon Aug 20 12:44:17 2012 -0400
mal2html-links: Add support for links/@depth attribute
xslt/common/html.xsl | 3 ++
xslt/mallard/html/mal2html-links.xsl | 46 ++++++++++++++++++++++++++++------
2 files changed, 41 insertions(+), 8 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 9964f2b..23db16b 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -862,6 +862,9 @@ pre.contents {
}
div.links .desc { color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>; }
div.links ul { margin: 0; padding: 0; }
+div.links ul ul {
+ margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1em;
+}
li.links {
margin: 0.5em 0 0.5em 0;
padding: 0;
diff --git a/xslt/mallard/html/mal2html-links.xsl b/xslt/mallard/html/mal2html-links.xsl
index 343299e..55af40f 100644
--- a/xslt/mallard/html/mal2html-links.xsl
+++ b/xslt/mallard/html/mal2html-links.xsl
@@ -454,6 +454,16 @@ element containing ${node}.
<xsl:param name="node" select="."/>
<xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
<xsl:variable name="style" select="concat(' ', $node/@style, ' ')"/>
+ <xsl:variable name="sectdepth">
+ <xsl:choose>
+ <xsl:when test="number(@depth) > 1">
+ <xsl:value-of select="round(number(@depth))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:if test="$node/../mal:section">
<div>
<xsl:attribute name="class">
@@ -484,20 +494,40 @@ element containing ${node}.
<xsl:with-param name="depth" select="$depth"/>
</xsl:apply-templates>
<div class="region">
- <ul>
- <xsl:for-each select="$node/../mal:section">
- <xsl:call-template name="mal2html.links.ul.li">
- <xsl:with-param name="xref" select="concat(/mal:page/@id, '#', @id)"/>
- <xsl:with-param name="role" select="'section'"/>
- </xsl:call-template>
- </xsl:for-each>
- </ul>
+ <xsl:call-template name="_mal2html.links.section.ul">
+ <xsl:with-param name="node" select="$node/.."/>
+ <xsl:with-param name="depth" select="number($sectdepth)"/>
+ </xsl:call-template>
</div>
</div>
</div>
</xsl:if>
</xsl:template>
+<!--#* _mal2html.links.section.ul -->
+<xsl:template name="_mal2html.links.section.ul">
+ <xsl:param name="node"/>
+ <xsl:param name="depth"/>
+ <ul>
+ <xsl:for-each select="$node/mal:section">
+ <xsl:call-template name="mal2html.links.ul.li">
+ <xsl:with-param name="xref" select="concat(/mal:page/@id, '#', @id)"/>
+ <xsl:with-param name="role" select="'section'"/>
+ </xsl:call-template>
+ <xsl:if test="$depth > 1 and mal:section">
+ <li class="links">
+ <ul>
+ <xsl:call-template name="_mal2html.links.section.ul">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="depth" select="$depth - 1"/>
+ </xsl:call-template>
+ </ul>
+ </li>
+ </xsl:if>
+ </xsl:for-each>
+ </ul>
+</xsl:template>
+
<!--**==========================================================================
mal2html.links.seealso
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]