summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@src.gnome.org>2007-05-23 22:38:00 +0000
committerShaun McCance <shaunm@src.gnome.org>2007-05-23 22:38:00 +0000
commite15dee19b596aff437f6286940e36ef47e6a107f (patch)
treee43a287bf2a438675426202f7f8139f815edf40d
parentd0b75e2c39d1184a37e8a9a014ebf2cb7bdc0735 (diff)
downloadyelp-xsl-e15dee19b596aff437f6286940e36ef47e6a107f.tar.gz
- Added some Pythonic goodies to classsynopsis
* test/testbook/testbook.xml: * xslt/docbook/html/db2html-classsynopsis.xsl: - Added some Pythonic goodies to classsynopsis * xslt/docbook/html/db2html-inline.xsl: - Fixed xsldoc error on l10n.format.mode svn path=/trunk/; revision=960
-rw-r--r--ChangeLog9
-rw-r--r--test/testbook/testbook.xml44
-rw-r--r--xslt/docbook/html/db2html-classsynopsis.xsl91
-rw-r--r--xslt/docbook/html/db2html-inline.xsl1
4 files changed, 129 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 24a6732c..51b76a8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
2007-05-23 Shaun McCance <shaunm@gnome.org>
* test/testbook/testbook.xml:
+ * xslt/docbook/html/db2html-classsynopsis.xsl:
+ - Added some Pythonic goodies to classsynopsis
+
+ * xslt/docbook/html/db2html-inline.xsl:
+ - Fixed xsldoc error on l10n.format.mode
+
+2007-05-23 Shaun McCance <shaunm@gnome.org>
+
+ * test/testbook/testbook.xml:
* xslt/docbook/common/db-chunk.xsl:
* xslt/docbook/html/db2html-bibliography.xsl:
- Made bibliodiv chunkable
diff --git a/test/testbook/testbook.xml b/test/testbook/testbook.xml
index 571f8f3f..9c289391 100644
--- a/test/testbook/testbook.xml
+++ b/test/testbook/testbook.xml
@@ -1703,6 +1703,50 @@ porttitor condimentum nulla.</para>
<methodsynopsis><methodname>get_relief</methodname><void/></methodsynopsis>
<fieldsynopsis><varname>fake</varname><initializer>True</initializer></fieldsynopsis>
</classsynopsis>
+
+<para>Here we use <sgmltag>modifier</sgmltag> for Python decorators:</para>
+<classsynopsis language="python">
+<ooclass><classname>Decorated</classname></ooclass>
+<ooclass><classname>Base1</classname></ooclass>
+<ooclass><classname>Base2</classname></ooclass>
+<ooclass><classname>Base3</classname></ooclass>
+<constructorsynopsis>
+ <modifier>@constructor</modifier>
+ <methodname>create</methodname>
+ <methodparam><parameter>input</parameter></methodparam>
+</constructorsynopsis>
+<constructorsynopsis>
+ <modifier>@destructor</modifier>
+ <methodname>destroy</methodname>
+ <void/>
+</constructorsynopsis>
+<fieldsynopsis>
+ <modifier>@private</modifier>
+ <varname>parts</varname>
+</fieldsynopsis>
+<methodsynopsis>
+ <modifier>@classmethod</modifier>
+ <methodname>find_all</methodname>
+ <void/>
+</methodsynopsis>
+</classsynopsis>
+
+<para>Here we use annotations from
+<ulink url="http://www.python.org/dev/peps/pep-3107/">PEP 3107</ulink>:</para>
+<methodsynopsis language="python">
+ <type>Frobnicated</type>
+ <methodname>frobnicate</methodname>
+ <methodparam>
+ <type>Frobnicatable</type>
+ <parameter>frob</parameter>
+ </methodparam>
+ <methodparam>
+ <type>bool</type>
+ <parameter>thorough</parameter>
+ <initializer>False</initializer>
+ </methodparam>
+</methodsynopsis>
+
</section> <!-- classsynopsis-python -->
</chapter> <!-- classsynopsis -->
diff --git a/xslt/docbook/html/db2html-classsynopsis.xsl b/xslt/docbook/html/db2html-classsynopsis.xsl
index ee73973f..3d67c5dd 100644
--- a/xslt/docbook/html/db2html-classsynopsis.xsl
+++ b/xslt/docbook/html/db2html-classsynopsis.xsl
@@ -375,7 +375,12 @@ REMARK: Describe this mode
<xsl:apply-templates mode="db2html.class.python.mode" select="ooclass[1]"/>
<xsl:if test="ooclass[2]">
<xsl:text>(</xsl:text>
- <xsl:apply-templates mode="db2html.class.python.mode" select="ooclass[2]"/>
+ <xsl:for-each select="ooclass[position() != 1]">
+ <xsl:if test="position() != 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
+ </xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:if>
<xsl:text>:&#x000A;</xsl:text>
@@ -396,9 +401,17 @@ REMARK: Describe this mode
(methodparam+ | void?)
}
-->
- <xsl:if test="../self::classsynopsis">
- <xsl:value-of select="$python.tab"/>
- </xsl:if>
+ <xsl:variable name="tab">
+ <xsl:if test="../self::classsynopsis">
+ <xsl:value-of select="$python.tab"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:for-each select="modifier">
+ <xsl:value-of select="$tab"/>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:for-each>
+ <xsl:value-of select="$tab"/>
<xsl:choose>
<xsl:when test="methodname">
<xsl:apply-templates mode="db2html.class.python.mode" select="methodname"/>
@@ -416,7 +429,12 @@ REMARK: Describe this mode
</xsl:if>
<xsl:apply-templates mode="db2html.class.python.mode" select="."/>
</xsl:for-each>
- <xsl:text>)&#x000A;</xsl:text>
+ <xsl:text>)</xsl:text>
+ <xsl:if test="type">
+ <xsl:text> -&gt; </xsl:text>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="type"/>
+ </xsl:if>
+ <xsl:text>&#x000A;</xsl:text>
</xsl:template>
<!-- = destructorsynopsis % db2html.class.python.mode = -->
@@ -428,9 +446,17 @@ REMARK: Describe this mode
(methodparam+ | void?)
}
-->
- <xsl:if test="../self::classsynopsis">
- <xsl:value-of select="$python.tab"/>
- </xsl:if>
+ <xsl:variable name="tab">
+ <xsl:if test="../self::classsynopsis">
+ <xsl:value-of select="$python.tab"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:for-each select="modifier">
+ <xsl:value-of select="$tab"/>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:for-each>
+ <xsl:value-of select="$tab"/>
<xsl:choose>
<xsl:when test="methodname">
<xsl:apply-templates mode="db2html.class.python.mode" select="methodname"/>
@@ -448,7 +474,12 @@ REMARK: Describe this mode
</xsl:if>
<xsl:apply-templates mode="db2html.class.python.mode" select="."/>
</xsl:for-each>
- <xsl:text>)&#x000A;</xsl:text>
+ <xsl:text>)</xsl:text>
+ <xsl:if test="type">
+ <xsl:text> -&gt; </xsl:text>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="type"/>
+ </xsl:if>
+ <xsl:text>&#x000A;</xsl:text>
</xsl:template>
<!-- = fieldsynopsis % db2html.class.python.mode = -->
@@ -461,9 +492,17 @@ REMARK: Describe this mode
initializer?
}
-->
- <xsl:if test="../self::classsynopsis">
- <xsl:value-of select="$python.tab"/>
- </xsl:if>
+ <xsl:variable name="tab">
+ <xsl:if test="../self::classsynopsis">
+ <xsl:value-of select="$python.tab"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:for-each select="modifier">
+ <xsl:value-of select="$tab"/>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:for-each>
+ <xsl:value-of select="$tab"/>
<xsl:apply-templates mode="db2html.class.python.mode" select="varname"/>
<xsl:if test="initializer">
<xsl:text>=</xsl:text>
@@ -476,6 +515,13 @@ REMARK: Describe this mode
<xsl:template mode="db2html.class.python.mode" match="methodparam">
<span class="methodparam">
<xsl:apply-templates mode="db2html.class.python.mode" select="parameter"/>
+ <xsl:if test="modifier or type">
+ <xsl:text>: </xsl:text>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="(modifier | type)[1]"/>
+ <xsl:if test="initializer">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:if>
<xsl:if test="initializer">
<xsl:text>=</xsl:text>
<xsl:apply-templates mode="db2html.class.python.mode" select="initializer"/>
@@ -493,9 +539,17 @@ REMARK: Describe this mode
(methodparam+ | void?)
}
-->
- <xsl:if test="../self::classsynopsis">
- <xsl:value-of select="$python.tab"/>
- </xsl:if>
+ <xsl:variable name="tab">
+ <xsl:if test="../self::classsynopsis">
+ <xsl:value-of select="$python.tab"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:for-each select="modifier">
+ <xsl:value-of select="$tab"/>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:for-each>
+ <xsl:value-of select="$tab"/>
<xsl:text>def </xsl:text>
<xsl:apply-templates mode="db2html.class.python.mode" select="methodname"/>
<xsl:text>(</xsl:text>
@@ -505,7 +559,12 @@ REMARK: Describe this mode
</xsl:if>
<xsl:apply-templates mode="db2html.class.python.mode" select="."/>
</xsl:for-each>
- <xsl:text>)&#x000A;</xsl:text>
+ <xsl:text>)</xsl:text>
+ <xsl:if test="type">
+ <xsl:text> -&gt; </xsl:text>
+ <xsl:apply-templates mode="db2html.class.python.mode" select="type"/>
+ </xsl:if>
+ <xsl:text>&#x000A;</xsl:text>
</xsl:template>
</xsl:stylesheet>
diff --git a/xslt/docbook/html/db2html-inline.xsl b/xslt/docbook/html/db2html-inline.xsl
index 57bd18cf..d2c4c417 100644
--- a/xslt/docbook/html/db2html-inline.xsl
+++ b/xslt/docbook/html/db2html-inline.xsl
@@ -27,6 +27,7 @@ DocBook to HTML - Inline Elements
REMARK: Describe this module
-->
+<!--#% l10n.format.mode -->
<!--**==========================================================================