[gobject-introspection] doctool: Use a base template for all node kinds that make sense
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] doctool: Use a base template for all node kinds that make sense
- Date: Sat, 2 Feb 2013 02:22:13 +0000 (UTC)
commit ae6f1592d4e423abc749e8d9f9a27191bcb1b85b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jan 31 18:58:13 2013 -0500
doctool: Use a base template for all node kinds that make sense
Makefile-giscanner.am | 2 +
giscanner/doctemplates/C/class.tmpl | 38 +------------------
giscanner/doctemplates/C/namespace.tmpl | 18 +--------
giscanner/doctemplates/Python/class.tmpl | 40 +-------------------
giscanner/doctemplates/Python/namespace.tmpl | 17 +--------
giscanner/doctemplates/class.tmpl | 40 ++++++++++++++++++++
giscanner/doctemplates/namespace.tmpl | 17 ++++++++
giscanner/mallardwriter.py | 2 +
.../DocExamples.Obj.page | 31 ++++++++-------
.../DocExamples.Obj.page | 6 +-
10 files changed, 84 insertions(+), 127 deletions(-)
---
diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am
index b586439..d5402f6 100644
--- a/Makefile-giscanner.am
+++ b/Makefile-giscanner.am
@@ -55,6 +55,8 @@ pkgpyexec_PYTHON = \
templatedir = $(pkglibdir)
nobase_template_DATA = \
giscanner/doctemplates/base.tmpl \
+ giscanner/doctemplates/class.tmpl \
+ giscanner/doctemplates/namespace.tmpl \
giscanner/doctemplates/C/class.tmpl \
giscanner/doctemplates/C/constructor.tmpl \
giscanner/doctemplates/C/default.tmpl \
diff --git a/giscanner/doctemplates/C/class.tmpl b/giscanner/doctemplates/C/class.tmpl
index 22a086c..3f18b02 100644
--- a/giscanner/doctemplates/C/class.tmpl
+++ b/giscanner/doctemplates/C/class.tmpl
@@ -1,38 +1,2 @@
<%! page_type="guide" %>\
-<%inherit file="/base.tmpl"/>
-<%block name="synopsis">
- <synopsis ui:expanded="no">
- <title>Hierarchy</title>
- <tree>
- <item>
- <code>GObjectObject</code>
- </item>
- </tree>
- </synopsis>
-</%block>
-<%block name="links">
- <links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-csrc"
- groups="constructor" style="linklist">
- <title>Constructors</title>
- </links>
- <links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-csrc"
- groups="method" style="linklist">
- <title>Methods</title>
- </links>
- <links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-csrc"
- groups="function" style="linklist">
- <title>Functions</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="property" style="linklist">
- <title>Properties</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="signal" style="linklist">
- <title>Signals</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
- <title>Other</title>
- </links>
-</%block>
+<%inherit file="/class.tmpl"/>
diff --git a/giscanner/doctemplates/C/namespace.tmpl b/giscanner/doctemplates/C/namespace.tmpl
index 10745fa..cb8195d 100644
--- a/giscanner/doctemplates/C/namespace.tmpl
+++ b/giscanner/doctemplates/C/namespace.tmpl
@@ -1,17 +1 @@
-<%! page_type="guide" %>\
-<%inherit file="/base.tmpl"/>
-<%block name="doc">
-</%block>
-<%block name="links">
- <links type="topic" ui:expanded="yes" groups="class" style="linklist">
- <title>Classes</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="function" style="linklist">
- <title>Functions</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
- <title>Other</title>
- </links>
-</%block>
-<%block name="since_version">
-</%block>
+<%inherit file="/namespace.tmpl"/>
diff --git a/giscanner/doctemplates/Python/class.tmpl b/giscanner/doctemplates/Python/class.tmpl
index 41e6e49..3991ff3 100644
--- a/giscanner/doctemplates/Python/class.tmpl
+++ b/giscanner/doctemplates/Python/class.tmpl
@@ -1,4 +1,4 @@
-<%inherit file="/base.tmpl"/>
+<%inherit file="/class.tmpl"/>
<%block name="synopsis">
<synopsis><code>
from gi.repository import ${namespace.name}
@@ -15,41 +15,3 @@ ${formatter.to_underscores(node.name).lower()} = ${namespace.name}.${node.name}(
)\
</code></synopsis>
</%block>
-<%block name="details">
- <synopsis>
- <title>Hierarchy</title>
- <tree>
-% for class_ in formatter.get_class_hierarchy(node):
- <item>
- <code>${class_.namespace.name}.${class_.name}</code>
-% endfor
-% for class_ in formatter.get_class_hierarchy(node):
- </item>
-% endfor
- </tree>
- </synopsis>
-</%block>
-<%block name="links">
- <links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-python"
- groups="method" style="linklist">
- <title>Methods</title>
- </links>
- <links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-python"
- groups="function" style="linklist">
- <title>Functions</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="property" style="linklist">
- <title>Properties</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="signal" style="linklist">
- <title>Signals</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="vfunc" style="linklist">
- <title>Virtual functions</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
- <title>Other</title>
- </links>
-</%block>
diff --git a/giscanner/doctemplates/Python/namespace.tmpl b/giscanner/doctemplates/Python/namespace.tmpl
index 10745fa..4d80c2a 100644
--- a/giscanner/doctemplates/Python/namespace.tmpl
+++ b/giscanner/doctemplates/Python/namespace.tmpl
@@ -1,17 +1,2 @@
<%! page_type="guide" %>\
-<%inherit file="/base.tmpl"/>
-<%block name="doc">
-</%block>
-<%block name="links">
- <links type="topic" ui:expanded="yes" groups="class" style="linklist">
- <title>Classes</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="function" style="linklist">
- <title>Functions</title>
- </links>
- <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
- <title>Other</title>
- </links>
-</%block>
-<%block name="since_version">
-</%block>
+<%inherit file="/namespace.tmpl"/>
diff --git a/giscanner/doctemplates/class.tmpl b/giscanner/doctemplates/class.tmpl
new file mode 100644
index 0000000..f264bc2
--- /dev/null
+++ b/giscanner/doctemplates/class.tmpl
@@ -0,0 +1,40 @@
+<%! page_type="guide" %>\
+<%inherit file="/base.tmpl"/>
+<%block name="details">
+ <synopsis>
+ <title>Hierarchy</title>
+ <tree>
+% for class_ in formatter.get_class_hierarchy(node):
+ <item>
+ <code>${class_.namespace.name}.${class_.name}</code>
+% endfor
+% for class_ in formatter.get_class_hierarchy(node):
+ </item>
+% endfor
+ </tree>
+ </synopsis>
+</%block>
+<%block name="links">
+ <links type="topic" ui:expanded="yes"
+ api:type="function" api:mime="${formatter.mime_type}"
+ groups="method" style="linklist">
+ <title>Methods</title>
+ </links>
+ <links type="topic" ui:expanded="yes"
+ api:type="function" api:mime="${formatter.mime_type}"
+ groups="function" style="linklist">
+ <title>Functions</title>
+ </links>
+ <links type="topic" ui:expanded="yes" groups="property" style="linklist">
+ <title>Properties</title>
+ </links>
+ <links type="topic" ui:expanded="yes" groups="signal" style="linklist">
+ <title>Signals</title>
+ </links>
+ <links type="topic" ui:expanded="yes" groups="vfunc" style="linklist">
+ <title>Virtual functions</title>
+ </links>
+ <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</%block>
diff --git a/giscanner/doctemplates/namespace.tmpl b/giscanner/doctemplates/namespace.tmpl
new file mode 100644
index 0000000..10745fa
--- /dev/null
+++ b/giscanner/doctemplates/namespace.tmpl
@@ -0,0 +1,17 @@
+<%! page_type="guide" %>\
+<%inherit file="/base.tmpl"/>
+<%block name="doc">
+</%block>
+<%block name="links">
+ <links type="topic" ui:expanded="yes" groups="class" style="linklist">
+ <title>Classes</title>
+ </links>
+ <links type="topic" ui:expanded="yes" groups="function" style="linklist">
+ <title>Functions</title>
+ </links>
+ <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</%block>
+<%block name="since_version">
+</%block>
diff --git a/giscanner/mallardwriter.py b/giscanner/mallardwriter.py
index b00de1f..bb5f893 100644
--- a/giscanner/mallardwriter.py
+++ b/giscanner/mallardwriter.py
@@ -349,6 +349,7 @@ class MallardFormatter(object):
class MallardFormatterC(MallardFormatter):
language = "C"
+ mime_type = "text/x-csrc"
fundamentals = {
"TRUE": "TRUE",
@@ -372,6 +373,7 @@ class MallardFormatterC(MallardFormatter):
class MallardFormatterPython(MallardFormatter):
language = "Python"
+ mime_type = "text/python"
fundamentals = {
"TRUE": "True",
diff --git a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.page b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.page
index eb90ad3..d3aeb46 100644
--- a/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.page
+++ b/tests/doctool/DocExamples-1.0-C-expected/DocExamples.Obj.page
@@ -12,15 +12,7 @@
</info>
<title>DocExamples.Obj</title>
- <synopsis ui:expanded="no">
- <title>Hierarchy</title>
- <tree>
- <item>
- <code>GObjectObject</code>
- </item>
- </tree>
- </synopsis>
-
+
<p>This is an example of how to document a class</p><p>This class has a signal: <link xref="DocExamples.Obj-signal-example">DocExamples.Obj::signal-example</link>.</p><p>And also has a property: <link xref="DocExamples.Obj-property-example">DocExamples.Obj:property-example</link>.</p>
@@ -28,15 +20,21 @@
<p>Since 0.99</p>
-
+ <synopsis>
+ <title>Hierarchy</title>
+ <tree>
+ <item>
+ <code>GObject.Object</code>
+ <item>
+ <code>DocExamples.Obj</code>
+ </item>
+ </item>
+ </tree>
+ </synopsis>
+
<links type="topic" ui:expanded="yes"
api:type="function" api:mime="text/x-csrc"
- groups="constructor" style="linklist">
- <title>Constructors</title>
- </links>
- <links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-csrc"
groups="method" style="linklist">
<title>Methods</title>
</links>
@@ -51,6 +49,9 @@
<links type="topic" ui:expanded="yes" groups="signal" style="linklist">
<title>Signals</title>
</links>
+ <links type="topic" ui:expanded="yes" groups="vfunc" style="linklist">
+ <title>Virtual functions</title>
+ </links>
<links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
<title>Other</title>
</links>
diff --git a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.page b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.page
index 8a0e3c2..ad02f50 100644
--- a/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.page
+++ b/tests/doctool/DocExamples-1.0-Python-expected/DocExamples.Obj.page
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<page id="DocExamples.Obj"
- type="topic"
+ type="guide"
style="class"
xmlns="http://projectmallard.org/1.0/"
xmlns:api="http://projectmallard.org/experimental/api/"
@@ -38,12 +38,12 @@ obj = DocExamples.Obj(<link xref='DocExamples.Obj-property-example'>property_exa
<links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-python"
+ api:type="function" api:mime="text/python"
groups="method" style="linklist">
<title>Methods</title>
</links>
<links type="topic" ui:expanded="yes"
- api:type="function" api:mime="text/x-python"
+ api:type="function" api:mime="text/python"
groups="function" style="linklist">
<title>Functions</title>
</links>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]