From 773d36876cfd5a23e32c506e78bdfc7383b05713 Mon Sep 17 00:00:00 2001 From: Shaun McCance Date: Thu, 18 Aug 2011 19:47:50 -0400 Subject: g-ir-doc-tool: Templates for signals/properties, class docs --- giscanner/mallard-C-class.tmpl | 11 ++++++----- giscanner/mallard-C-property.tmpl | 13 +++++++++++++ giscanner/mallard-C-signal.tmpl | 13 +++++++++++++ giscanner/mallard-Python-class.tmpl | 11 ++++++----- giscanner/mallard-Python-function.tmpl | 4 +++- giscanner/mallard-Python-method.tmpl | 4 +++- giscanner/mallard-Python-property.tmpl | 13 +++++++++++++ giscanner/mallard-Python-signal.tmpl | 13 +++++++++++++ giscanner/mallardwriter.py | 13 ++++++++++++- 9 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 giscanner/mallard-C-property.tmpl create mode 100644 giscanner/mallard-C-signal.tmpl create mode 100644 giscanner/mallard-Python-property.tmpl create mode 100644 giscanner/mallard-Python-signal.tmpl 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 @@ ${node.namespace.name}${node.name} +${format(node.doc)} Hierarchy @@ -16,19 +17,19 @@ - + Constructors - + Methods - + Properties - + Signals - + Other 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 @@ + + + + + ${node.name} + + ${parent.ctype}:${node.name} +${format(node.doc)} + 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 @@ + + + + + ${node.name} + + ${parent.ctype}::${node.name} +${format(node.doc)} + 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 @@ ${node.namespace.name}.${node.name} +${format(node.doc)} Hierarchy @@ -16,19 +17,19 @@ - + Constructors - + Methods - + Properties - + Signals - + Other 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"> + ${node.symbol} ${node.symbol} ${format(node.doc)} 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"> + ${node.symbol} ${node.symbol} ${format(node.doc)} 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 @@ + + + + + ${node.name} + + ${namespace.name}.${parent.name}:${node.name} +${format(node.doc)} + 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 @@ + + + + + ${node.name} + + ${namespace.name}.${parent.name}::${node.name} +${format(node.doc)} + 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, -- cgit v1.2.1