summaryrefslogtreecommitdiff
path: root/xslt
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2009-05-02 17:58:27 -0500
committerShaun McCance <shaunm@gnome.org>2009-05-02 17:58:27 -0500
commit6b43e99cfbe6c0e1cb419f8b46a45c146a3d364a (patch)
tree8cb3c661c05831834b4ab67fa5a6796c86b09b0d /xslt
parentd40482de65df45b3a681e06ddf597bbcb13b435a (diff)
downloadyelp-tools-6b43e99cfbe6c0e1cb419f8b46a45c146a3d364a.tar.gz
Adding listing & fixing first-child issues for mal2html.block.mode
Diffstat (limited to 'xslt')
-rw-r--r--xslt/mallard/html/mal2html-block.xsl96
-rw-r--r--xslt/mallard/html/mal2html-css.xsl5
-rw-r--r--xslt/mallard/html/mal2html-page.xsl9
3 files changed, 80 insertions, 30 deletions
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
index 8d1d205..fb3fad2 100644
--- a/xslt/mallard/html/mal2html-block.xsl
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -106,6 +106,8 @@ div.figure-contents {
}
div.figure div.title { margin: 0 0 4px 0; }
div.figure div.desc { margin: 4px 0 0 0; }
+div.listing div.title { font-size: 1em; margin: 0 0 4px 0; }
+div.listing div.desc { margin: 0 0 4px 0; font-style: italic; }
pre.screen {
background-color: </xsl:text>
<xsl:call-template name="theme.get_color">
@@ -150,12 +152,13 @@ FIXME
-->
<xsl:template name="mal2html.pre">
<xsl:param name="node" select="."/>
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
<xsl:variable name="first" select="$node/node()[1]/self::text()"/>
<xsl:variable name="last" select="$node/node()[last()]/self::text()"/>
<pre>
<xsl:attribute name="class">
<xsl:value-of select="local-name($node)"/>
- <xsl:if test="not(preceding-sibling::*)">
+ <xsl:if test="$first_child">
<xsl:text> first-child</xsl:text>
</xsl:if>
</xsl:attribute>
@@ -184,32 +187,35 @@ FIXME
<!-- = desc = -->
<xsl:template mode="mal2html.block.mode" match="mal:desc">
<div class="desc">
- <xsl:apply-templates mode="mal2html.block.mode"/>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
</div>
</xsl:template>
<!-- = code = -->
<xsl:template mode="mal2html.block.mode" match="mal:code">
- <xsl:call-template name="mal2html.pre"/>
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:call-template name="mal2html.pre">
+ <xsl:with-param name="first_child" select="$first_child"/>
+ </xsl:call-template>
</xsl:template>
<!-- = comment = -->
<xsl:template mode="mal2html.block.mode" match="mal:comment">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
<div>
<xsl:attribute name="class">
<xsl:text>comment</xsl:text>
- <xsl:if test="not(preceding-sibling::*)">
+ <xsl:if test="$first_child">
<xsl:text> first-child</xsl:text>
</xsl:if>
</xsl:attribute>
- <xsl:apply-templates mode="mal2html.block.mode"/>
- </div>
-</xsl:template>
-
-<!-- = comment/title = -->
-<xsl:template mode="mal2html.block.mode" match="mal:comment/mal:title">
- <div class="title">
- <xsl:apply-templates mode="mal2html.inline.mode"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:cite)]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
</div>
</xsl:template>
@@ -234,39 +240,63 @@ FIXME
<!-- = example = -->
<xsl:template mode="mal2html.block.mode" match="mal:example">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
<div>
<xsl:attribute name="class">
<xsl:text>example</xsl:text>
- <xsl:if test="not(preceding-sibling::*)">
+ <xsl:if test="$first_child">
<xsl:text> first-child</xsl:text>
</xsl:if>
</xsl:attribute>
- <xsl:apply-templates mode="mal2html.block.mode"/>
+ <xsl:for-each select="mal:*">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
</div>
</xsl:template>
<!-- = figure = -->
<xsl:template mode="mal2html.block.mode" match="mal:figure">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
<div>
<xsl:attribute name="class">
<xsl:text>figure</xsl:text>
- <xsl:if test="not(preceding-sibling::*)">
+ <xsl:if test="$first_child">
<xsl:text> first-child</xsl:text>
</xsl:if>
</xsl:attribute>
<xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
<div class="figure-contents">
- <xsl:apply-templates mode="mal2html.block.mode"
- select="*[not(self::mal:title or self::mal:desc)]"/>
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
</div>
<xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
</div>
</xsl:template>
-<!-- = figure/title = -->
-<xsl:template mode="mal2html.block.mode" match="mal:figure/mal:title">
- <div class="title">
- <xsl:apply-templates mode="mal2html.inline.mode"/>
+<!-- = listing = -->
+<xsl:template mode="mal2html.block.mode" match="mal:listing">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>listing</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+ <div class="listing-contents">
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
</div>
</xsl:template>
@@ -275,10 +305,11 @@ FIXME
<!-- = p = -->
<xsl:template mode="mal2html.block.mode" match="mal:p">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
<p>
<xsl:attribute name="class">
<xsl:text>p</xsl:text>
- <xsl:if test="not(preceding-sibling::*)">
+ <xsl:if test="$first_child">
<xsl:text> first-child</xsl:text>
</xsl:if>
</xsl:attribute>
@@ -288,24 +319,35 @@ FIXME
<!-- = screen = -->
<xsl:template mode="mal2html.block.mode" match="mal:screen">
- <xsl:call-template name="mal2html.pre"/>
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:call-template name="mal2html.pre">
+ <xsl:with-param name="first_child" select="$first_child"/>
+ </xsl:call-template>
</xsl:template>
<!-- = synopsis = -->
<xsl:template mode="mal2html.block.mode" match="mal:synopsis">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
<div class="synopsis">
<xsl:attribute name="class">
<xsl:text>synopsis</xsl:text>
- <xsl:if test="not(preceding-sibling::*)">
+ <xsl:if test="$first_child">
<xsl:text> first-child</xsl:text>
</xsl:if>
</xsl:attribute>
- <xsl:apply-templates mode="mal2html.block.mode"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+ <div class="synopsis-contents">
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
</div>
</xsl:template>
-<!-- = synopsis/title = -->
-<xsl:template mode="mal2html.block.mode" match="mal:synopsis/mal:title">
+<xsl:template mode="mal2html.block.mode" match="mal:title">
<div class="title">
<xsl:apply-templates mode="mal2html.inline.mode"/>
</div>
diff --git a/xslt/mallard/html/mal2html-css.xsl b/xslt/mallard/html/mal2html-css.xsl
index fae4f96..65b673c 100644
--- a/xslt/mallard/html/mal2html-css.xsl
+++ b/xslt/mallard/html/mal2html-css.xsl
@@ -331,7 +331,10 @@ div.comment {
div.comment div.comment {
margin: 1em 0 0 1em;
}
-div.comment div.cite { margin: 0; font-style: italic; }
+div.comment div.cite {
+ margin: 0 0 0.5em 0;
+ font-style: italic;
+}
</xsl:text>
</xsl:template>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 855f940..2e2d6d0 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -447,7 +447,7 @@ REMARK: Describe this template
<xsl:template match="mal:section">
<div class="section" id="{@id}">
<div class="header">
- <xsl:apply-templates mode="mal2html.block.mode"
+ <xsl:apply-templates mode="mal2html.title.mode"
select="mal:title | mal:subtitle"/>
</div>
<div class="contents">
@@ -465,8 +465,13 @@ REMARK: Describe this template
</div>
</xsl:template>
+<!-- = subtitle = -->
+<xsl:template mode="mal2html.title.mode" match="mal:subtitle">
+ <!-- FIXME -->
+</xsl:template>
+
<!-- = title = -->
-<xsl:template mode="mal2html.block.mode" match="mal:title">
+<xsl:template mode="mal2html.title.mode" match="mal:title">
<xsl:variable name="depth"
select="count(ancestor::mal:section) + 1"/>
<xsl:element name="{concat('h', $depth)}">