[gobject-introspection] g-ir-doc-tool: Add -expected test for Python docbook



commit b15800a2ab572e2713b5ace3e3bca1b5958257f5
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Sun Aug 14 11:10:14 2011 +0200

    g-ir-doc-tool: Add -expected test for Python docbook

 giscanner/docbookwriter.py                         |  107 ++++++----
 giscanner/docmain.py                               |   15 ++-
 ...xpected.xml => GIRepository-2.0-C-expected.xml} |    0
 ...ed.xml => GIRepository-2.0-Python-expected.xml} |  226 ++++++++++----------
 tests/doctool/Makefile.am                          |   18 +-
 5 files changed, 200 insertions(+), 166 deletions(-)
---
diff --git a/giscanner/docbookwriter.py b/giscanner/docbookwriter.py
index 822a5ab..443aaa8 100644
--- a/giscanner/docbookwriter.py
+++ b/giscanner/docbookwriter.py
@@ -38,12 +38,15 @@ def _space(num):
     return " " * num
 
 class DocBookFormatter(object):
-    def __init__(self, writer):
-        self._namespace = None
-        self._writer = writer
+    def __init__(self):
+        self.namespace = None
+        self.writer = None
 
     def set_namespace(self, namespace):
-        self._namespace = namespace
+        self.namespace = namespace
+
+    def set_writer(self, writer):
+        self.writer = writer
 
     def get_type_string(self, type):
         return str(type.ctype)
@@ -52,17 +55,17 @@ class DocBookFormatter(object):
         return "%s %s" % (param_type, param_name)
 
     def _render_parameter(self, param, extra_content=''):
-        with self._writer.tagcontext("parameter"):
+        with self.writer.tagcontext("parameter"):
             if param.type.ctype is not None:
                 link_dest = param.type.ctype.replace("*", "")
             else:
                 link_dest = param.type.ctype
-            with self._writer.tagcontext("link", [("linkend", "%s" % link_dest)]):
-                self._writer.write_tag("type", [], link_dest)
-            self._writer.write_line(extra_content)
+            with self.writer.tagcontext("link", [("linkend", "%s" % link_dest)]):
+                self.writer.write_tag("type", [], link_dest)
+            self.writer.write_line(extra_content)
 
     def _render_parameters(self, parent, parameters):
-        self._writer.write_line(
+        self.writer.write_line(
             "%s(" % _space(40 - len(parent.symbol)))
 
         parent_class = parent.parent_class
@@ -74,7 +77,7 @@ class DocBookFormatter(object):
         first_param = True
         for param in params:
             if not first_param:
-                self._writer.write_line("\n%s" % _space(61))
+                self.writer.write_line("\n%s" % _space(61))
             else:
                 first_param = False
 
@@ -84,8 +87,8 @@ class DocBookFormatter(object):
                 comma = ""
 
             if isinstance(param.type, ast.Varargs):
-                with self._writer.tagcontext("parameter"):
-                    self._writer.write_line('...%s' % comma)
+                with self.writer.tagcontext("parameter"):
+                    self.writer.write_line('...%s' % comma)
             else:
                 extra_content = " "
                 if param.type.ctype is not None and '*' in param.type.ctype:
@@ -94,16 +97,14 @@ class DocBookFormatter(object):
                 extra_content += comma
                 self._render_parameter(param, extra_content)
 
-        self._writer.write_line(");\n")
+        self.writer.write_line(");\n")
 
     def get_method_as_title(self, entity):
         method = entity.get_ast()
         return "%s ()" % method.symbol
 
     def get_page_name(self, node):
-        if isinstance(node, ast.Alias) or node.gtype_name is None:
-            return node.ctype
-        return node.gtype_name
+        pass
 
     def get_class_name(self, node):
         if node.gtype_name is None:
@@ -125,7 +126,7 @@ class DocBookFormatter(object):
 
     def render_method(self, entity, link=False):
         method = entity.get_ast()
-        self._writer.disable_whitespace()
+        self.writer.disable_whitespace()
 
         retval_type = method.retval.type
         if retval_type.ctype:
@@ -135,28 +136,28 @@ class DocBookFormatter(object):
 
         if retval_type.target_giname:
             ns = retval_type.target_giname.split('.')
-            if ns[0] == self._namespace.name:
+            if ns[0] == self.namespace.name:
                 link_dest = "%s" % (
                     retval_type.ctype.replace("*", ""))
 
-        with self._writer.tagcontext("link", [("linkend", link_dest)]):
-            self._writer.write_tag("returnvalue", [], link_dest)
+        with self.writer.tagcontext("link", [("linkend", link_dest)]):
+            self.writer.write_tag("returnvalue", [], link_dest)
 
         if '*' in retval_type.ctype:
-            self._writer.write_line(' *')
+            self.writer.write_line(' *')
 
-        self._writer.write_line(
+        self.writer.write_line(
             _space(20 - len(self.get_type_string(method.retval.type))))
 
         if link:
-            self._writer.write_tag("link", [("linkend",
+            self.writer.write_tag("link", [("linkend",
                                             method.symbol.replace("_", "-"))],
                                   method.symbol)
         else:
-            self._writer.write_line(method.symbol)
+            self.writer.write_line(method.symbol)
 
         self._render_parameters(method, method.parameters)
-        self._writer.enable_whitespace()
+        self.writer.enable_whitespace()
 
     def _get_annotations(self, argument):
         annotations = {}
@@ -189,31 +190,31 @@ class DocBookFormatter(object):
                            self._get_annotations(method.retval))
 
     def _render_param(self, argname, doc, annotations):
-        with self._writer.tagcontext('varlistentry'):
-            with self._writer.tagcontext('term'):
-                self._writer.disable_whitespace()
+        with self.writer.tagcontext('varlistentry'):
+            with self.writer.tagcontext('term'):
+                self.writer.disable_whitespace()
                 try:
-                    with self._writer.tagcontext('parameter'):
-                        self._writer.write_line(argname)
+                    with self.writer.tagcontext('parameter'):
+                        self.writer.write_line(argname)
                     if doc is not None:
-                        self._writer.write_line('&#xA0;:')
+                        self.writer.write_line('&#xA0;:')
                 finally:
-                    self._writer.enable_whitespace()
+                    self.writer.enable_whitespace()
             if doc is not None:
-                with self._writer.tagcontext('listitem'):
-                    with self._writer.tagcontext('simpara'):
-                        self._writer.write_line(doc)
+                with self.writer.tagcontext('listitem'):
+                    with self.writer.tagcontext('simpara'):
+                        self.writer.write_line(doc)
                         if annotations:
-                            with self._writer.tagcontext('emphasis', [('role', 'annotation')]):
+                            with self.writer.tagcontext('emphasis', [('role', 'annotation')]):
                                 for key, value in annotations.iteritems():
-                                    self._writer.disable_whitespace()
+                                    self.writer.disable_whitespace()
                                     try:
-                                        self._writer.write_line('[%s' % key)
+                                        self.writer.write_line('[%s' % key)
                                         if value is not None:
-                                            self._writer.write_line(' %s' % value)
-                                        self._writer.write_line(']')
+                                            self.writer.write_line(' %s' % value)
+                                        self.writer.write_line(']')
                                     finally:
-                                        self._writer.enable_whitespace()
+                                        self.writer.enable_whitespace()
 
     def render_property(self, entity, link=False):
         prop = entity.get_ast()
@@ -233,15 +234,15 @@ class DocBookFormatter(object):
         self._render_prop_or_signal(prop_name, prop_type, flags)
 
     def _render_prop_or_signal(self, name, type_, flags):
-        self._writer.disable_whitespace()
+        self.writer.disable_whitespace()
 
         line = _space(2) + name + _space(27 - len(name))
         line += str(type_) + _space(22 - len(str(type_)))
         line += ": " + " / ".join(flags)
 
-        self._writer.write_line(line + "\n")
+        self.writer.write_line(line + "\n")
 
-        self._writer.enable_whitespace()
+        self.writer.enable_whitespace()
 
 
     def render_signal(self, entity, link=False):
@@ -252,6 +253,18 @@ class DocBookFormatter(object):
         self._render_prop_or_signal(sig_name, "", flags)
 
 
+class DocBookFormatterPython(DocBookFormatter):
+    def get_page_name(self, node):
+        return node.name
+
+
+class DocBookFormatterC(DocBookFormatter):
+    def get_page_name(self, node):
+        if isinstance(node, ast.Alias) or node.gtype_name is None:
+            return node.ctype
+        return node.gtype_name
+
+
 class DocBookPage(object):
     def __init__(self, name, ast):
         self.methods = []
@@ -297,12 +310,14 @@ class DocBookEntity(object):
 
 
 class DocBookWriter(object):
-    def __init__(self):
+    def __init__(self, formatter):
         self._namespace = None
         self._pages = []
 
         self._writer = XMLWriter()
-        self._formatter = DocBookFormatter(self._writer)
+
+        formatter.set_writer(self._writer)
+        self._formatter = formatter
 
     def _add_page(self, page):
         self._pages.append(page)
diff --git a/giscanner/docmain.py b/giscanner/docmain.py
index 29b5ddf..3bffaef 100644
--- a/giscanner/docmain.py
+++ b/giscanner/docmain.py
@@ -21,6 +21,8 @@
 import optparse
 
 from .docbookwriter import DocBookWriter
+from .docbookwriter import DocBookFormatterC
+from .docbookwriter import DocBookFormatterPython
 from .transformer import Transformer
 
 class GIDocGenerator(object):
@@ -42,6 +44,10 @@ def doc_main(args):
                       action="store", dest="format",
                       default="docbook",
                       help="Output format")
+    parser.add_option("-l", "--language",
+                      action="store", dest="language",
+                      default="Python",
+                      help="Output language")
 
     options, args = parser.parse_args(args)
     if not options.output:
@@ -50,8 +56,15 @@ def doc_main(args):
     if len(args) < 2:
         raise SystemExit("Need an input GIR filename")
 
+    if options.language == "Python":
+        formatter = DocBookFormatterPython()
+    elif options.language == "C":
+        formatter = DocBookFormatterC()
+    else:
+        raise SystemExit("Unsupported language: %s" % (options.language, ))
+
     if options.format == "docbook":
-        writer = DocBookWriter()
+        writer = DocBookWriter(formatter)
     else:
         raise SystemExit("Unsupported output format: %s" % (options.format, ))
 
diff --git a/tests/doctool/GIRepository-2.0-expected.xml b/tests/doctool/GIRepository-2.0-C-expected.xml
similarity index 100%
copy from tests/doctool/GIRepository-2.0-expected.xml
copy to tests/doctool/GIRepository-2.0-C-expected.xml
diff --git a/tests/doctool/GIRepository-2.0-expected.xml b/tests/doctool/GIRepository-2.0-Python-expected.xml
similarity index 92%
rename from tests/doctool/GIRepository-2.0-expected.xml
rename to tests/doctool/GIRepository-2.0-Python-expected.xml
index b475586..7d24f2a 100644
--- a/tests/doctool/GIRepository-2.0-expected.xml
+++ b/tests/doctool/GIRepository-2.0-Python-expected.xml
@@ -8,12 +8,12 @@
       xmlns="http://docbook.org/ns/docbook";
       version="5.0">
   <title>GIRepository Documentation</title>
-  <chapter xml:id="ch_GIArgInfo">
-    <title>GIArgInfo</title>
-    <refsynopsisdiv id="GIArgInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_ArgInfo">
+    <title>ArgInfo</title>
+    <refsynopsisdiv id="ArgInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIArgInfo-struct">GIArgInfo</link>;
+struct               <link linkend="ArgInfo-struct">ArgInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giarginfo-details" role="details">
@@ -28,12 +28,12 @@ struct               <link linkend="GIArgInfo-struct">GIArgInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GICallableInfo">
-    <title>GICallableInfo</title>
-    <refsynopsisdiv id="GICallableInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_CallableInfo">
+    <title>CallableInfo</title>
+    <refsynopsisdiv id="CallableInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GICallableInfo-struct">GICallableInfo</link>;
+struct               <link linkend="CallableInfo-struct">CallableInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gicallableinfo-details" role="details">
@@ -49,12 +49,12 @@ struct               <link linkend="GICallableInfo-struct">GICallableInfo</link>
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GICallbackInfo">
-    <title>GICallbackInfo</title>
-    <refsynopsisdiv id="GICallbackInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_CallbackInfo">
+    <title>CallbackInfo</title>
+    <refsynopsisdiv id="CallbackInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GICallbackInfo-struct">GICallbackInfo</link>;
+struct               <link linkend="CallbackInfo-struct">CallbackInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gicallbackinfo-details" role="details">
@@ -69,12 +69,12 @@ struct               <link linkend="GICallbackInfo-struct">GICallbackInfo</link>
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIConstantInfo">
-    <title>GIConstantInfo</title>
-    <refsynopsisdiv id="GIConstantInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_ConstantInfo">
+    <title>ConstantInfo</title>
+    <refsynopsisdiv id="ConstantInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIConstantInfo-struct">GIConstantInfo</link>;
+struct               <link linkend="ConstantInfo-struct">ConstantInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giconstantinfo-details" role="details">
@@ -89,12 +89,12 @@ struct               <link linkend="GIConstantInfo-struct">GIConstantInfo</link>
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIEnumInfo">
-    <title>GIEnumInfo</title>
-    <refsynopsisdiv id="GIEnumInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_EnumInfo">
+    <title>EnumInfo</title>
+    <refsynopsisdiv id="EnumInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIEnumInfo-struct">GIEnumInfo</link>;
+struct               <link linkend="EnumInfo-struct">EnumInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gienuminfo-details" role="details">
@@ -109,12 +109,12 @@ struct               <link linkend="GIEnumInfo-struct">GIEnumInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIErrorDomainInfo">
-    <title>GIErrorDomainInfo</title>
-    <refsynopsisdiv id="GIErrorDomainInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_ErrorDomainInfo">
+    <title>ErrorDomainInfo</title>
+    <refsynopsisdiv id="ErrorDomainInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIErrorDomainInfo-struct">GIErrorDomainInfo</link>;
+struct               <link linkend="ErrorDomainInfo-struct">ErrorDomainInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gierrordomaininfo-details" role="details">
@@ -129,12 +129,12 @@ struct               <link linkend="GIErrorDomainInfo-struct">GIErrorDomainInfo<
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIFieldInfo">
-    <title>GIFieldInfo</title>
-    <refsynopsisdiv id="GIFieldInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_FieldInfo">
+    <title>FieldInfo</title>
+    <refsynopsisdiv id="FieldInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIFieldInfo-struct">GIFieldInfo</link>;
+struct               <link linkend="FieldInfo-struct">FieldInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gifieldinfo-details" role="details">
@@ -149,12 +149,12 @@ struct               <link linkend="GIFieldInfo-struct">GIFieldInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIFunctionInfo">
-    <title>GIFunctionInfo</title>
-    <refsynopsisdiv id="GIFunctionInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_FunctionInfo">
+    <title>FunctionInfo</title>
+    <refsynopsisdiv id="FunctionInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIFunctionInfo-struct">GIFunctionInfo</link>;
+struct               <link linkend="FunctionInfo-struct">FunctionInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gifunctioninfo-details" role="details">
@@ -169,12 +169,12 @@ struct               <link linkend="GIFunctionInfo-struct">GIFunctionInfo</link>
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIInterfaceInfo">
-    <title>GIInterfaceInfo</title>
-    <refsynopsisdiv id="GIInterfaceInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_InterfaceInfo">
+    <title>InterfaceInfo</title>
+    <refsynopsisdiv id="InterfaceInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIInterfaceInfo-struct">GIInterfaceInfo</link>;
+struct               <link linkend="InterfaceInfo-struct">InterfaceInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giinterfaceinfo-details" role="details">
@@ -189,12 +189,12 @@ struct               <link linkend="GIInterfaceInfo-struct">GIInterfaceInfo</lin
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIObjectInfo">
-    <title>GIObjectInfo</title>
-    <refsynopsisdiv id="GIObjectInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_ObjectInfo">
+    <title>ObjectInfo</title>
+    <refsynopsisdiv id="ObjectInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIObjectInfo-struct">GIObjectInfo</link>;
+struct               <link linkend="ObjectInfo-struct">ObjectInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giobjectinfo-details" role="details">
@@ -209,12 +209,12 @@ struct               <link linkend="GIObjectInfo-struct">GIObjectInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIPropertyInfo">
-    <title>GIPropertyInfo</title>
-    <refsynopsisdiv id="GIPropertyInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_PropertyInfo">
+    <title>PropertyInfo</title>
+    <refsynopsisdiv id="PropertyInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIPropertyInfo-struct">GIPropertyInfo</link>;
+struct               <link linkend="PropertyInfo-struct">PropertyInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gipropertyinfo-details" role="details">
@@ -229,12 +229,12 @@ struct               <link linkend="GIPropertyInfo-struct">GIPropertyInfo</link>
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIRegisteredTypeInfo">
-    <title>GIRegisteredTypeInfo</title>
-    <refsynopsisdiv id="GIRegisteredTypeInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_RegisteredTypeInfo">
+    <title>RegisteredTypeInfo</title>
+    <refsynopsisdiv id="RegisteredTypeInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIRegisteredTypeInfo-struct">GIRegisteredTypeInfo</link>;
+struct               <link linkend="RegisteredTypeInfo-struct">RegisteredTypeInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giregisteredtypeinfo-details" role="details">
@@ -249,12 +249,12 @@ struct               <link linkend="GIRegisteredTypeInfo-struct">GIRegisteredTyp
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GISignalInfo">
-    <title>GISignalInfo</title>
-    <refsynopsisdiv id="GISignalInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_SignalInfo">
+    <title>SignalInfo</title>
+    <refsynopsisdiv id="SignalInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GISignalInfo-struct">GISignalInfo</link>;
+struct               <link linkend="SignalInfo-struct">SignalInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gisignalinfo-details" role="details">
@@ -269,12 +269,12 @@ struct               <link linkend="GISignalInfo-struct">GISignalInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIStructInfo">
-    <title>GIStructInfo</title>
-    <refsynopsisdiv id="GIStructInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_StructInfo">
+    <title>StructInfo</title>
+    <refsynopsisdiv id="StructInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIStructInfo-struct">GIStructInfo</link>;
+struct               <link linkend="StructInfo-struct">StructInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gistructinfo-details" role="details">
@@ -289,12 +289,12 @@ struct               <link linkend="GIStructInfo-struct">GIStructInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GITypeInfo">
-    <title>GITypeInfo</title>
-    <refsynopsisdiv id="GITypeInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_TypeInfo">
+    <title>TypeInfo</title>
+    <refsynopsisdiv id="TypeInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GITypeInfo-struct">GITypeInfo</link>;
+struct               <link linkend="TypeInfo-struct">TypeInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="gitypeinfo-details" role="details">
@@ -309,12 +309,12 @@ struct               <link linkend="GITypeInfo-struct">GITypeInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIUnionInfo">
-    <title>GIUnionInfo</title>
-    <refsynopsisdiv id="GIUnionInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_UnionInfo">
+    <title>UnionInfo</title>
+    <refsynopsisdiv id="UnionInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIUnionInfo-struct">GIUnionInfo</link>;
+struct               <link linkend="UnionInfo-struct">UnionInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giunioninfo-details" role="details">
@@ -329,12 +329,12 @@ struct               <link linkend="GIUnionInfo-struct">GIUnionInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIVFuncInfo">
-    <title>GIVFuncInfo</title>
-    <refsynopsisdiv id="GIVFuncInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_VFuncInfo">
+    <title>VFuncInfo</title>
+    <refsynopsisdiv id="VFuncInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIVFuncInfo-struct">GIVFuncInfo</link>;
+struct               <link linkend="VFuncInfo-struct">VFuncInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="givfuncinfo-details" role="details">
@@ -349,12 +349,12 @@ struct               <link linkend="GIVFuncInfo-struct">GIVFuncInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIValueInfo">
-    <title>GIValueInfo</title>
-    <refsynopsisdiv id="GIValueInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_ValueInfo">
+    <title>ValueInfo</title>
+    <refsynopsisdiv id="ValueInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
       <synopsis>
-struct               <link linkend="GIValueInfo-struct">GIValueInfo</link>;
+struct               <link linkend="ValueInfo-struct">ValueInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="givalueinfo-details" role="details">
@@ -369,13 +369,13 @@ struct               <link linkend="GIValueInfo-struct">GIValueInfo</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIAttributeIter">
-    <title>GIAttributeIter</title>
-    <refsynopsisdiv id="GIAttributeIter.synopsis" role="synopsis">
+  <chapter xml:id="ch_AttributeIter">
+    <title>AttributeIter</title>
+    <refsynopsisdiv id="AttributeIter.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="GIAttributeIter"/>
+      <anchor id="AttributeIter"/>
       <synopsis>
-struct               <link linkend="GIAttributeIter-struct">GIAttributeIter</link>;
+struct               <link linkend="AttributeIter-struct">AttributeIter</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giattributeiter-details" role="details">
@@ -389,13 +389,13 @@ struct               <link linkend="GIAttributeIter-struct">GIAttributeIter</lin
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIBaseInfo">
-    <title>GIBaseInfo</title>
-    <refsynopsisdiv id="GIBaseInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_BaseInfo">
+    <title>BaseInfo</title>
+    <refsynopsisdiv id="BaseInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="GIBaseInfo"/>
+      <anchor id="BaseInfo"/>
       <synopsis>
-struct               <link linkend="GIBaseInfo-struct">GIBaseInfo</link>;
+struct               <link linkend="BaseInfo-struct">BaseInfo</link>;
 <link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            <link linkend="g-base-info-equal">g_base_info_equal</link>                       (<parameter><link linkend="GIBaseInfo"><type>GIBaseInfo</type></link> *baseinfo, </parameter>
                                                              <parameter><link linkend="GIBaseInfo"><type>GIBaseInfo</type></link> *info2</parameter>);
 <link linkend="gchar"><returnvalue>gchar</returnvalue></link> *              <link linkend="g-base-info-get-attribute">g_base_info_get_attribute</link>               (<parameter><link linkend="GIBaseInfo"><type>GIBaseInfo</type></link> *baseinfo, </parameter>
@@ -799,13 +799,13 @@ drops to 0, the info is freed.</para>
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIRepository">
-    <title>GIRepository</title>
-    <refsynopsisdiv id="GIRepository.synopsis" role="synopsis">
+  <chapter xml:id="ch_Repository">
+    <title>Repository</title>
+    <refsynopsisdiv id="Repository.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="GIRepository"/>
+      <anchor id="Repository"/>
       <synopsis>
-struct               <link linkend="GIRepository-struct">GIRepository</link>;
+struct               <link linkend="Repository-struct">Repository</link>;
 <link linkend="GList"><returnvalue>GList</returnvalue></link> *              <link linkend="g-irepository-enumerate-versions">g_irepository_enumerate_versions</link>        (<parameter><link linkend="GIRepository"><type>GIRepository</type></link> *repository, </parameter>
                                                              <parameter><link linkend="gchar"><type>gchar</type></link> *namespace_</parameter>);
 <link linkend="GIBaseInfo"><returnvalue>GIBaseInfo</returnvalue></link> *         <link linkend="g-irepository-find-by-gtype">g_irepository_find_by_gtype</link>             (<parameter><link linkend="GIRepository"><type>GIRepository</type></link> *repository, </parameter>
@@ -846,7 +846,7 @@ struct               <link linkend="GIRepository-struct">GIRepository</link>;
                                                              <parameter><link linkend="GIRepositoryLoadFlags"><type>GIRepositoryLoadFlags</type></link> flags</parameter>);
       </synopsis>
     </refsynopsisdiv>
-    <refsect1 id="GIRepository.object-hierarchy" role="object_hierarchy">
+    <refsect1 id="Repository.object-hierarchy" role="object_hierarchy">
       <title role="object_hierarchy.title">Object Hierarchy</title>
       <synopsis>
   GObject
@@ -1588,13 +1588,13 @@ not specified, the latest will be used.</para>
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIRepositoryClass">
-    <title>GIRepositoryClass</title>
-    <refsynopsisdiv id="GIRepositoryClass.synopsis" role="synopsis">
+  <chapter xml:id="ch_RepositoryClass">
+    <title>RepositoryClass</title>
+    <refsynopsisdiv id="RepositoryClass.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="GIRepositoryClass"/>
+      <anchor id="RepositoryClass"/>
       <synopsis>
-struct               <link linkend="GIRepositoryClass-struct">GIRepositoryClass</link>;
+struct               <link linkend="RepositoryClass-struct">RepositoryClass</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="girepositoryclass-details" role="details">
@@ -1608,13 +1608,13 @@ struct               <link linkend="GIRepositoryClass-struct">GIRepositoryClass<
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIRepositoryPrivate">
-    <title>GIRepositoryPrivate</title>
-    <refsynopsisdiv id="GIRepositoryPrivate.synopsis" role="synopsis">
+  <chapter xml:id="ch_RepositoryPrivate">
+    <title>RepositoryPrivate</title>
+    <refsynopsisdiv id="RepositoryPrivate.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="GIRepositoryPrivate"/>
+      <anchor id="RepositoryPrivate"/>
       <synopsis>
-struct               <link linkend="GIRepositoryPrivate-struct">GIRepositoryPrivate</link>;
+struct               <link linkend="RepositoryPrivate-struct">RepositoryPrivate</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="girepositoryprivate-details" role="details">
@@ -1628,13 +1628,13 @@ struct               <link linkend="GIRepositoryPrivate-struct">GIRepositoryPriv
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GITypelib">
-    <title>GITypelib</title>
-    <refsynopsisdiv id="GITypelib.synopsis" role="synopsis">
+  <chapter xml:id="ch_Typelib">
+    <title>Typelib</title>
+    <refsynopsisdiv id="Typelib.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="GITypelib"/>
+      <anchor id="Typelib"/>
       <synopsis>
-struct               <link linkend="GITypelib-struct">GITypelib</link>;
+struct               <link linkend="Typelib-struct">Typelib</link>;
 <link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="g-typelib-free">g_typelib_free</link>                          (<parameter><link linkend="GITypelib"><type>GITypelib</type></link> *typelib</parameter>);
 <link linkend="gchar"><returnvalue>gchar</returnvalue></link> *              <link linkend="g-typelib-get-namespace">g_typelib_get_namespace</link>                 (<parameter><link linkend="GITypelib"><type>GITypelib</type></link> *typelib</parameter>);
 <link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>            <link linkend="g-typelib-symbol">g_typelib_symbol</link>                        (<parameter><link linkend="GITypelib"><type>GITypelib</type></link> *typelib, </parameter>
@@ -1738,13 +1738,13 @@ struct               <link linkend="GITypelib-struct">GITypelib</link>;
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch_GIUnresolvedInfo">
-    <title>GIUnresolvedInfo</title>
-    <refsynopsisdiv id="GIUnresolvedInfo.synopsis" role="synopsis">
+  <chapter xml:id="ch_UnresolvedInfo">
+    <title>UnresolvedInfo</title>
+    <refsynopsisdiv id="UnresolvedInfo.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="GIUnresolvedInfo"/>
+      <anchor id="UnresolvedInfo"/>
       <synopsis>
-struct               <link linkend="GIUnresolvedInfo-struct">GIUnresolvedInfo</link>;
+struct               <link linkend="UnresolvedInfo-struct">UnresolvedInfo</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="giunresolvedinfo-details" role="details">
@@ -1758,13 +1758,13 @@ struct               <link linkend="GIUnresolvedInfo-struct">GIUnresolvedInfo</l
       </refsect2>
     </refsect1>
   </chapter>
-  <chapter xml:id="ch__GIBaseInfoStub">
-    <title>_GIBaseInfoStub</title>
-    <refsynopsisdiv id="_GIBaseInfoStub.synopsis" role="synopsis">
+  <chapter xml:id="ch__BaseInfoStub">
+    <title>_BaseInfoStub</title>
+    <refsynopsisdiv id="_BaseInfoStub.synopsis" role="synopsis">
       <title role="synopsis.title">Synopsis</title>
-      <anchor id="_GIBaseInfoStub"/>
+      <anchor id="_BaseInfoStub"/>
       <synopsis>
-struct               <link linkend="_GIBaseInfoStub-struct">_GIBaseInfoStub</link>;
+struct               <link linkend="_BaseInfoStub-struct">_BaseInfoStub</link>;
       </synopsis>
     </refsynopsisdiv>
     <refsect1 id="_gibaseinfostub-details" role="details">
diff --git a/tests/doctool/Makefile.am b/tests/doctool/Makefile.am
index 1552930..46e54be 100644
--- a/tests/doctool/Makefile.am
+++ b/tests/doctool/Makefile.am
@@ -4,17 +4,23 @@ GIRepository-2.0.gir:
 	cp ../../GIRepository-2.0.gir .
 
 GIRS = GIRepository-2.0.gir
-CHECKXML = $(GIRS:.gir=.xml.check)
+CHECKXML = $(GIRS:.gir=-C.xml.check) $(GIRS:.gir=-Python.xml.check)
 DOCBOOKFILES = $(GIRS:.gir=.xml)
 EXPECTEDDOCBOOKFILES = $(DOCBOOKFILES:.xml=-expected.xml)
 CLEANFILES = $(DOCBOOK_FILES)
 BUILT_SOURCES = $(DOCBOOK_FILES)
 EXTRA_DIST = $(EXPECTEDDOCBOOKFILES)
 
-%.xml: %.gir
-	$(INTROSPECTION_DOCTOOL) $*.gir -o $*.xml && echo "  GEN  $*.xml"
+%-C.xml: %.gir
+	$(INTROSPECTION_DOCTOOL) --language C $*.gir -o $*-C.xml && echo "  GEN  $*-C.xml"
 
-%.xml.check: %.xml
-	@diff -u -U 10 $(srcdir)/$*-expected.xml $*.xml && echo "  TEST  $*.xml"
+%-Python.xml: %.gir
+	$(INTROSPECTION_DOCTOOL) --language Python $*.gir -o $*-Python.xml && echo "  GEN  $*-Python.xml"
 
-check-local: $(CHECKXML) $(TYPELIBS)
+%-C.xml.check: %-C.xml
+	@diff -u -U 10 $(srcdir)/$*-C-expected.xml $*-C.xml && echo "  TEST  $*-C.xml"
+
+%-Python.xml.check: %-Python.xml
+	@diff -u -U 10 $(srcdir)/$*-Python-expected.xml $*-Python.xml && echo "  TEST  $*-Python.xml"
+
+check-local: $(CHECKXML)



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