[gnome-doc-utils/mallard] Adding listing & fixing first-child issues for mal2html.block.mode
- From: Shaun McCance <shaunm src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-doc-utils/mallard] Adding listing & fixing first-child issues for mal2html.block.mode
- Date: Sat, 2 May 2009 19:37:33 -0400 (EDT)
commit 6b43e99cfbe6c0e1cb419f8b46a45c146a3d364a
Author: Shaun McCance <shaunm gnome org>
Date: Sat May 2 17:58:27 2009 -0500
Adding listing & fixing first-child issues for mal2html.block.mode
---
doc/mallard/C/mal_block.xml | 3 +-
doc/mallard/C/mal_block_comment.xml | 1 +
doc/mallard/C/mal_block_figure.xml | 2 +-
doc/mallard/C/mal_block_listing.xml | 42 +++++++++++++++
xslt/mallard/html/mal2html-block.xsl | 96 ++++++++++++++++++++++++----------
xslt/mallard/html/mal2html-css.xsl | 5 ++-
xslt/mallard/html/mal2html-page.xsl | 9 +++-
7 files changed, 126 insertions(+), 32 deletions(-)
diff --git a/doc/mallard/C/mal_block.xml b/doc/mallard/C/mal_block.xml
index 1215fd5..1221ef8 100644
--- a/doc/mallard/C/mal_block.xml
+++ b/doc/mallard/C/mal_block.xml
@@ -23,8 +23,9 @@
mal_block = (
<link xref="mal_block_code">mal_block_code</link> |
<link xref="mal_block_comment">mal_block_comment</link> |
- <link xref="mal_block_example">mal_block_comment</link> |
+ <link xref="mal_block_example">mal_block_example</link> |
<link xref="mal_block_figure">mal_block_figure</link> |
+ <link xref="mal_block_listing">mal_block_listing</link> |
<link xref="mal_block_media">mal_block_media</link> |
<link xref="mal_block_note">mal_block_note</link> |
<link xref="mal_block_p">mal_block_p</link> |
diff --git a/doc/mallard/C/mal_block_comment.xml b/doc/mallard/C/mal_block_comment.xml
index 2f6bddc..a5f7699 100644
--- a/doc/mallard/C/mal_block_comment.xml
+++ b/doc/mallard/C/mal_block_comment.xml
@@ -54,6 +54,7 @@ attribute. Writers are highly encouraged to provide a <code xref="mal_date">mal
-->
<comment>
+ <title>Comment Title</title>
<cite date="2006-11-16"><name>Shaun McCance</name></cite>
<p>Add examples, processing expectations</p>
diff --git a/doc/mallard/C/mal_block_figure.xml b/doc/mallard/C/mal_block_figure.xml
index 7478a62..b61aca7 100644
--- a/doc/mallard/C/mal_block_figure.xml
+++ b/doc/mallard/C/mal_block_figure.xml
@@ -3,7 +3,7 @@
id="mal_block_figure">
<info>
- <link type="guide" xref="mal_block#containers"/>
+ <link type="guide" xref="mal_block#elements"/>
<version number="0.1" date="2007-02-21" status="stub"/>
</info>
diff --git a/doc/mallard/C/mal_block_listing.xml b/doc/mallard/C/mal_block_listing.xml
new file mode 100644
index 0000000..9ada0c7
--- /dev/null
+++ b/doc/mallard/C/mal_block_listing.xml
@@ -0,0 +1,42 @@
+<page xmlns="http://www.gnome.org/~shaunm/mallard"
+ type="topic"
+ id="mal_block_listing">
+
+<info>
+ <link type="guide" xref="mal_block#elements"/>
+ <version number="0.1" date="2009-05-02" status="stub"/>
+</info>
+
+<title>Listings</title>
+
+<synopsis><code mime="application/relax-ng-compact-syntax">
+mal_block_listing = element listing {
+ attribute style { xsd:NMTOKENS } ?,
+ attribute * - (mal:* | local:*) { text } *,
+
+ <link xref="mal_title">mal_title</link> ?,
+ <link xref="mal_block_desc">mal_block_desc</link> ?,
+ <link xref="mal_block">mal_block</link> +
+}
+</code></synopsis>
+
+<comment>
+ <cite date="2009-05-02"><name>Shaun McCance</name></cite>
+ <p>Add explanation, examples, processing expectations</p>
+</comment>
+
+<!-- BEGIN examples -->
+<section id="examples">
+ <title>Examples</title>
+
+ <example>
+ <listing>
+ <title>foo.c</title>
+ <desc>Some stuff in foo.c</desc>
+ <code>int foo ()</code>
+ </listing>
+ </example>
+</section>
+<!-- END examples -->
+
+</page>
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)}">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]