summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2011-08-18 19:47:50 -0400
committerTomeu Vizoso <tomeu.vizoso@collabora.com>2012-02-17 10:27:40 +0100
commit773d36876cfd5a23e32c506e78bdfc7383b05713 (patch)
tree00817b91c5513458e5cd92e3fcf804e27c608d75
parentf470cf8dcad5fc2815ade3484d52b8d5a4bf816b (diff)
downloadgobject-introspection-773d36876cfd5a23e32c506e78bdfc7383b05713.tar.gz
g-ir-doc-tool: Templates for signals/properties, class docs
-rw-r--r--giscanner/mallard-C-class.tmpl11
-rw-r--r--giscanner/mallard-C-property.tmpl13
-rw-r--r--giscanner/mallard-C-signal.tmpl13
-rw-r--r--giscanner/mallard-Python-class.tmpl11
-rw-r--r--giscanner/mallard-Python-function.tmpl4
-rw-r--r--giscanner/mallard-Python-method.tmpl4
-rw-r--r--giscanner/mallard-Python-property.tmpl13
-rw-r--r--giscanner/mallard-Python-signal.tmpl13
-rw-r--r--giscanner/mallardwriter.py13
9 files changed, 82 insertions, 13 deletions
diff --git a/giscanner/mallard-C-class.tmpl b/giscanner/mallard-C-class.tmpl
index c08aea0a..5dc59220 100644
--- a/giscanner/mallard-C-class.tmpl
+++ b/giscanner/mallard-C-class.tmpl
@@ -8,6 +8,7 @@
<link type="guide" xref="index" group="class"/>
</info>
<title>${node.namespace.name}${node.name}</title>
+${format(node.doc)}
<synopsis ui:expanded="no">
<title>Hierarchy</title>
<tree>
@@ -16,19 +17,19 @@
</item>
</tree>
</synopsis>
- <links type="topic" ui:expanded="yes" groups="constructor">
+ <links type="topic" ui:expanded="yes" groups="constructor" style="linklist">
<title>Constructors</title>
</links>
- <links type="topic" ui:expanded="yes" groups="method">
+ <links type="topic" ui:expanded="yes" groups="method" style="linklist">
<title>Methods</title>
</links>
- <links type="topic" ui:expanded="yes" groups="property">
+ <links type="topic" ui:expanded="yes" groups="property" style="linklist">
<title>Properties</title>
</links>
- <links type="topic" ui:expanded="yes" groups="signal">
+ <links type="topic" ui:expanded="yes" groups="signal" style="linklist">
<title>Signals</title>
</links>
- <links type="topic" ui:expanded="yes" groups="#first #default #last">
+ <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
<title>Other</title>
</links>
</page>
diff --git a/giscanner/mallard-C-property.tmpl b/giscanner/mallard-C-property.tmpl
new file mode 100644
index 00000000..84f33c68
--- /dev/null
+++ b/giscanner/mallard-C-property.tmpl
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<page id="${namespace.name}.${node.name}"
+ type="topic"
+ style="property"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:ui="http://projectmallard.org/experimental/ui/">
+ <info>
+ <link type="guide" xref="${namespace.name}.${parent.name}" group="property"/>
+ <title type="link" role="topic">${node.name}</title>
+ </info>
+ <title>${parent.ctype}:${node.name}</title>
+${format(node.doc)}
+</page>
diff --git a/giscanner/mallard-C-signal.tmpl b/giscanner/mallard-C-signal.tmpl
new file mode 100644
index 00000000..08fc7a99
--- /dev/null
+++ b/giscanner/mallard-C-signal.tmpl
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<page id="${namespace.name}.${node.name}"
+ type="topic"
+ style="signal"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:ui="http://projectmallard.org/experimental/ui/">
+ <info>
+ <link type="guide" xref="${namespace.name}.${parent.name}" group="signal"/>
+ <title type="link" role="topic">${node.name}</title>
+ </info>
+ <title>${parent.ctype}::${node.name}</title>
+${format(node.doc)}
+</page>
diff --git a/giscanner/mallard-Python-class.tmpl b/giscanner/mallard-Python-class.tmpl
index 020c6729..bd283ff6 100644
--- a/giscanner/mallard-Python-class.tmpl
+++ b/giscanner/mallard-Python-class.tmpl
@@ -8,6 +8,7 @@
<link type="guide" xref="index" group="class"/>
</info>
<title>${node.namespace.name}.${node.name}</title>
+${format(node.doc)}
<synopsis ui:expanded="no">
<title>Hierarchy</title>
<tree>
@@ -16,19 +17,19 @@
</item>
</tree>
</synopsis>
- <links type="topic" ui:expanded="yes" groups="constructor">
+ <links type="topic" ui:expanded="yes" groups="constructor" style="linklist">
<title>Constructors</title>
</links>
- <links type="topic" ui:expanded="yes" groups="method">
+ <links type="topic" ui:expanded="yes" groups="method" style="linklist">
<title>Methods</title>
</links>
- <links type="topic" ui:expanded="yes" groups="property">
+ <links type="topic" ui:expanded="yes" groups="property" style="linklist">
<title>Properties</title>
</links>
- <links type="topic" ui:expanded="yes" groups="signal">
+ <links type="topic" ui:expanded="yes" groups="signal" style="linklist">
<title>Signals</title>
</links>
- <links type="topic" ui:expanded="yes" groups="#first #default #last">
+ <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist">
<title>Other</title>
</links>
</page>
diff --git a/giscanner/mallard-Python-function.tmpl b/giscanner/mallard-Python-function.tmpl
index fabbe31a..1f88001c 100644
--- a/giscanner/mallard-Python-function.tmpl
+++ b/giscanner/mallard-Python-function.tmpl
@@ -3,9 +3,11 @@
type="topic"
style="function"
xmlns="http://projectmallard.org/1.0/"
- xmlns:ui="http://projectmallard.org/experimental/ui/">
+ xmlns:ui="http://projectmallard.org/experimental/ui/"
+ xmlns:c="http://www.gtk.org/introspection/c/1.0">
<info>
<link type="guide" xref="index" group="function"/>
+ <c:identifier>${node.symbol}</c:identifier>
</info>
<title>${node.symbol}</title>
${format(node.doc)}</page>
diff --git a/giscanner/mallard-Python-method.tmpl b/giscanner/mallard-Python-method.tmpl
index bf998ab0..53e58f3c 100644
--- a/giscanner/mallard-Python-method.tmpl
+++ b/giscanner/mallard-Python-method.tmpl
@@ -3,9 +3,11 @@
type="topic"
style="method"
xmlns="http://projectmallard.org/1.0/"
- xmlns:ui="http://projectmallard.org/experimental/ui/">
+ xmlns:ui="http://projectmallard.org/experimental/ui/"
+ xmlns:c="http://www.gtk.org/introspection/c/1.0">
<info>
<link type="guide" xref="${namespace.name}.${parent.name}" group="method"/>
+ <c:identifier>${node.symbol}</c:identifier>
</info>
<title>${node.symbol}</title>
${format(node.doc)}</page>
diff --git a/giscanner/mallard-Python-property.tmpl b/giscanner/mallard-Python-property.tmpl
new file mode 100644
index 00000000..33b420e7
--- /dev/null
+++ b/giscanner/mallard-Python-property.tmpl
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<page id="${namespace.name}.${node.name}"
+ type="topic"
+ style="property"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:ui="http://projectmallard.org/experimental/ui/">
+ <info>
+ <link type="guide" xref="${namespace.name}.${parent.name}" group="property"/>
+ <title type="link" role="topic">${node.name}</title>
+ </info>
+ <title>${namespace.name}.${parent.name}:${node.name}</title>
+${format(node.doc)}
+</page>
diff --git a/giscanner/mallard-Python-signal.tmpl b/giscanner/mallard-Python-signal.tmpl
new file mode 100644
index 00000000..2ae7ae92
--- /dev/null
+++ b/giscanner/mallard-Python-signal.tmpl
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<page id="${namespace.name}.${node.name}"
+ type="topic"
+ style="signal"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:ui="http://projectmallard.org/experimental/ui/">
+ <info>
+ <link type="guide" xref="${namespace.name}.${parent.name}" group="signal"/>
+ <title type="link" role="topic">${node.name}</title>
+ </info>
+ <title>${namespace.name}.${parent.name}::${node.name}</title>
+${format(node.doc)}
+</page>
diff --git a/giscanner/mallardwriter.py b/giscanner/mallardwriter.py
index 5c2e2955..dbf76dd2 100644
--- a/giscanner/mallardwriter.py
+++ b/giscanner/mallardwriter.py
@@ -80,6 +80,11 @@ class MallardWriter(object):
if isinstance(node, (ast.Class, ast.Record)):
for method in node.methods:
self._render_node(method, output, node)
+ if isinstance(node, ast.Class):
+ for property_ in node.properties:
+ self._render_node(property_, output, node)
+ for signal in node.signals:
+ self._render_node(signal, output, node)
def _render_node(self, node, output, parent=None):
namespace = self._transformer.namespace
@@ -98,6 +103,12 @@ class MallardWriter(object):
elif isinstance(node, ast.Function):
template_name = 'mallard-%s-function.tmpl' % self._language
page_id = '%s.%s' % (namespace.name, node.name)
+ elif isinstance(node, ast.Property) and parent is not None:
+ template_name = 'mallard-%s-property.tmpl' % self._language
+ page_id = '%s.%s-%s' % (namespace.name, parent.name, node.name)
+ elif isinstance(node, ast.Signal) and parent is not None:
+ template_name = 'mallard-%s-signal.tmpl' % self._language
+ page_id = '%s.%s-%s' % (namespace.name, parent.name, node.name)
else:
template_name = 'mallard-%s-default.tmpl' % self._language
page_id = '%s.%s' % (namespace.name, node.name)
@@ -109,7 +120,7 @@ class MallardWriter(object):
template_dir = 'unimplemented'
file_name = os.path.join(template_dir, template_name)
- template = Template(filename=file_name)
+ template = Template(filename=file_name, output_encoding='utf-8')
result = template.render(namespace=namespace,
node=node,
format=format,