[gobject-introspection/wip/docs: 14/23] mallardwriter: Simply use the parent page name for nested pages



commit 6b05869529ee7aeb7ccb5787339a70657b6ef0f5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jan 31 18:23:46 2013 -0500

    mallardwriter: Simply use the parent page name for nested pages
    
    If we have a parent page, we might as well use it so that parent
    names are consistent across pages.

 giscanner/mallardwriter.py |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/giscanner/mallardwriter.py b/giscanner/mallardwriter.py
index 844c319..191a47f 100644
--- a/giscanner/mallardwriter.py
+++ b/giscanner/mallardwriter.py
@@ -303,17 +303,14 @@ class MallardFormatter(object):
     def format_page_name(self, node):
         if isinstance(node, ast.Namespace):
             return 'Index'
-
-        namespace = node.namespace
-
-        if isinstance(node, ast.Function):
+        elif isinstance(node, ast.Function):
             return self.format_function_name(node)
         elif isinstance(node, ast.Property) and node.parent is not None:
-            return '%s.%s:%s' % (namespace.name, node.parent.name, node.name)
+            return '%s:%s' % (self.format_page_name(node.parent), node.name)
         elif isinstance(node, ast.Signal) and node.parent is not None:
-            return '%s.%s::%s' % (namespace.name, node.parent.name, node.name)
+            return '%s::%s' % (self.format_page_name(node.parent), node.name)
         elif isinstance(node, ast.VFunction) and node.parent is not None:
-            return '%s.%s::%s' % (namespace.name, node.parent.name, node.name)
+            return '%s::%s' % (self.format_page_name(node.parent), node.name)
         else:
             return make_page_id(node)
 



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