summaryrefslogtreecommitdiff
path: root/giscanner/docwriter.py
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2015-11-21 21:02:02 -0800
committerrockon999 <rockon999@users.noreply.github.com>2018-08-06 02:53:45 -0500
commit9719dd21669084b6ccaaef07899db8416e235a74 (patch)
tree42274386b8e376db2d4945f70d728dd6db6b1b31 /giscanner/docwriter.py
parent7f67146d8254464f396b289ed41c8954d61fe03d (diff)
downloadgobject-introspection-9719dd21669084b6ccaaef07899db8416e235a74.tar.gz
devdocs: Render a summary at the top of each page
This summary, heavily inspired by the one from pgi-docs, is useful when browsing the page rather than searching for a specific term. It's also similar to the summary at the top of gtk-doc pages.
Diffstat (limited to 'giscanner/docwriter.py')
-rw-r--r--giscanner/docwriter.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py
index f26ed5b1..cba8a5d8 100644
--- a/giscanner/docwriter.py
+++ b/giscanner/docwriter.py
@@ -454,7 +454,7 @@ class DocFormatter(object):
def field_is_writable(self, field):
return True
- def format_property_flags(self, property_, construct_only=False):
+ def format_property_flags(self, property_, construct_only=False, abbrev=False):
flags = []
if property_.readable and not construct_only:
@@ -468,6 +468,9 @@ class DocFormatter(object):
if property_.construct_only:
flags.append("Construct Only")
+ if abbrev:
+ return "/".join([''.join([word[0] for word in flag.lower().split()])
+ for flag in flags])
return " / ".join(flags)
def format_signal_flags(self, signal):
@@ -512,6 +515,20 @@ class DocFormatter(object):
parent_chain.reverse()
return parent_chain
+ def get_inheritable_types(self, node):
+ """Return an ast.Node object for each type (ast.Class and ast.Interface
+ types) from which an ast.Class @node might inherit methods, properties,
+ and signals."""
+
+ assert isinstance(node, ast.Class)
+
+ parent_chain = self.get_class_hierarchy(node)
+ types = []
+ for p in parent_chain:
+ types += [self._transformer.lookup_typenode(t) for t in p.interfaces]
+ types += [t for t in parent_chain if t is not node]
+ return types
+
def format_prerequisites(self, node):
assert isinstance(node, ast.Interface)