diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-03-27 17:09:16 -0400 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-06-10 12:34:35 -0400 |
commit | a1ec815afd2dd4379ce443efbb4d4aca4cf97c33 (patch) | |
tree | ebc574ae3a6b79a3e0adc976ebf5fcd36c67c4c3 /giscanner/girwriter.py | |
parent | d906932afae1b4e961b8cf3210b2dee95f73058b (diff) | |
download | gobject-introspection-doc-sections.tar.gz |
giscanner: Create AST nodes for SECTION: doc blocks; add a GIR nodedoc-sections
These will eventually be paired with the sections file parser to create
a set of sections.
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r-- | giscanner/girwriter.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index 3bea2a1c..79799c39 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -115,6 +115,8 @@ class GIRWriter(XMLWriter): self._write_alias(node) elif isinstance(node, ast.Constant): self._write_constant(node) + elif isinstance(node, ast.Section): + self._write_section(node) else: print 'WRITER: Unhandled node', node @@ -402,6 +404,25 @@ class GIRWriter(XMLWriter): self._write_generic(constant) self._write_type(constant.value_type) + def _write_section(self, section): + attrs = [('name', section.name), + ('title', section.title), + ('include', section.include), + ('image', section.image), + ('section-id', section.section_id)] + self._append_node_generic(section, attrs) + + with self.tagcontext('section', attrs): + self._write_generic(section) + + def write_child(name, content): + if content: + self.write_tag(name, [('xml:whitespace', 'preserve')], content) + + write_child('short-description', section.short_description) + write_child('long-description', section.long_description) + write_child('see-also', section.see_also) + def _write_class(self, node): attrs = [('name', node.name), ('c:symbol-prefix', node.c_symbol_prefix), |