summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2012-08-20 12:44:17 -0400
committerShaun McCance <shaunm@gnome.org>2012-08-20 12:46:05 -0400
commit23bc5c4bb2fdeb8ebe30e44fc8fc4dd93a11ad04 (patch)
tree19d8673aea8e4e49670197e1597dfaf1c3ec1350
parent948eaeb9057a11c9b8a420fde59c802a98236158 (diff)
downloadyelp-xsl-23bc5c4bb2fdeb8ebe30e44fc8fc4dd93a11ad04.tar.gz
mal2html-links: Add support for links/@depth attribute
-rw-r--r--xslt/common/html.xsl3
-rw-r--r--xslt/mallard/html/mal2html-links.xsl46
2 files changed, 41 insertions, 8 deletions
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 9964f2b5..23db16b7 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 343299ee..55af40f4 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