diff options
author | Johan Dahlin <johan@gnome.org> | 2011-02-01 16:14:00 -0200 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2011-02-01 16:38:42 -0200 |
commit | ed5437545efbf4e86833e1c632de76f30bb4ea52 (patch) | |
tree | 4fb352472dba63693e27bdc23260e06d0fd32dfc /giscanner | |
parent | d79670b1bf45bdb51635c9775d29b1c34ea18110 (diff) | |
download | gobject-introspection-ed5437545efbf4e86833e1c632de76f30bb4ea52.tar.gz |
Preserve gtk-doc section names
Preserve the section names and write them out on the class/record/
interface.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/annotationparser.py | 12 | ||||
-rw-r--r-- | giscanner/maintransformer.py | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 3b376be2..f267d84d 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -123,7 +123,10 @@ class DocBlock(object): if self.options: options += ' ' options += ' '.join('(%s)' % o for o in self.options) - lines = [self.name + ':' + options] + lines = [self.name] + if 'SECTION' not in self.name: + lines[0] += ':' + lines[0] += options tags = [] for name, tag in self.tags.iteritems(): if name in self.params: @@ -451,8 +454,11 @@ class AnnotationParser(object): block_header = block_header.strip() cpos = block_header.find(': ') block_name = block_header - if cpos: - block_name = block_name[:cpos] + raw_name = block_header + if cpos != -1: + block_name = block_name[:cpos].strip() + if block_name.endswith(':'): + block_name = block_name[:-1] block = DocBlock(block_name) block.set_position(message.Position(filename, lineno)) diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 893b3b71..1fcf5e81 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -217,6 +217,11 @@ usage is void (*_gtk_reserved1)(void);""" block = self._get_block(node) for field in node.fields: self._apply_annotations_field(node, block, field) + name = self._get_annotation_name(node) + section_name = 'SECTION:' + name.lower() + block = self._blocks.get(section_name) + if block: + node.doc = block.comment if isinstance(node, (ast.Class, ast.Interface)): for prop in node.properties: self._apply_annotations_property(node, prop) |