[gobject-introspection/gir-docbook] g-ir-doc-tool: Add structs (no fields yet) and thus fix arguments links



commit 4a4cc95d13eef2503b73a01a88dcc37c733c3a30
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Sat Aug 13 14:31:10 2011 +0200

    g-ir-doc-tool: Add structs (no fields yet) and thus fix arguments links

 giscanner/docbookwriter.py |   42 ++++++++++++++++++++++++++++++++----------
 1 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/giscanner/docbookwriter.py b/giscanner/docbookwriter.py
index 7d6c3b4..1eae0a4 100644
--- a/giscanner/docbookwriter.py
+++ b/giscanner/docbookwriter.py
@@ -347,16 +347,29 @@ class DocBookWriter(object):
         with self._writer.tagcontext("chapter", [("xml:id", "ch_%s" % (
                         page.name))]):
             self._writer.write_tag(
-                "refentry", [("id", "%s" % (page.id))])
-            self._writer.write_tag(
                 "title", [], page.name)
 
             with self._writer.tagcontext("refsynopsisdiv",
                     [('id', '%s.synopsis' % page.name),
                      ('role', 'synopsis')]):
+
                 self._writer.write_tag(
                     "title", [("role", "synopsis.title")], "Synopsis")
+
+                self._writer.write_tag("anchor", [("id", page.name)])
+
                 with self._writer.tagcontext('synopsis'):
+                    self._writer.disable_whitespace()
+                    try:
+                        self._writer.write_line("struct               ")
+                        self._writer.write_tag(
+                            "link",
+                            [("linkend", "%s-struct" % page.name)],
+                            "%s" % page.name)
+                        self._writer.write_line(";\n")
+                    finally:
+                        self._writer.enable_whitespace()
+
                     for entity in page.get_methods():
                         self._formatter.render_method(entity, link=True)
 
@@ -407,14 +420,14 @@ class DocBookWriter(object):
             #         desc = desc.replace("&", "&amp;")
             #         self._writer.write_line(desc)
 
-            if page.get_methods():
-                with self._writer.tagcontext('refsect1',
-                                            [('id', "%s-details" % page.name),
-                                             ("role", "details")]):
-                    self._writer.write_tag("title", [("role", "details.title")],
-                                          "Details")
-                    for entity in page.get_methods():
-                        self._render_method(entity)
+            with self._writer.tagcontext('refsect1',
+                                        [('id', "%s-details" % page.id.lower()),
+                                         ("role", "details")]):
+                self._writer.write_tag("title", [("role", "details.title")],
+                                      "Details")
+                self._render_struct(page.ast)
+                for entity in page.get_methods():
+                    self._render_method(entity)
 
             if page.get_properties():
                 with self._writer.tagcontext('refsect1',
@@ -434,6 +447,15 @@ class DocBookWriter(object):
                     for entity in page.get_signals():
                         self._render_signal(entity)
 
+    def _render_struct(self, struct):
+        with self._writer.tagcontext('refsect2',
+                              [('id', "%s-struct" % struct.ctype),
+                               ('role', 'struct')]):
+            self._writer.write_tag("title", [], "struct %s" % struct.ctype)
+            with self._writer.tagcontext("indexterm", [("zone", "%s-struct" % struct.ctype)]):
+                self._writer.write_tag("primary", [("sortas", struct.name)], struct.ctype)
+            self._writer.write_tag("programlisting", [], "struct %s;" % struct.ctype)
+
     def _render_method(self, entity):
 
         link_name = entity.get_ast().symbol.replace("_", "-")



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