[gobject-introspection/mallard-templates] g-ir-doc-tool: Templates for signals/properties, class docs



commit f73d4f05792ebbea8de25373c67c69a768e752e6
Author: Shaun McCance <shaunm gnome org>
Date:   Thu Aug 18 19:47:50 2011 -0400

    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(-)
---
diff --git a/giscanner/mallard-C-class.tmpl b/giscanner/mallard-C-class.tmpl
index c08aea0..5dc5922 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 0000000..84f33c6
--- /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 0000000..08fc7a9
--- /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 020c672..bd283ff 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 fabbe31..1f88001 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 bf998ab..53e58f3 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 0000000..33b420e
--- /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 0000000..2ae7ae9
--- /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 5c2e295..dbf76dd 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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]