summaryrefslogtreecommitdiff
path: root/giscanner/maintransformer.py
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2018-11-19 21:49:13 -0300
committerThibault Saunier <tsaunier@igalia.com>2018-11-28 09:29:07 -0300
commit925c3b875861e83d3d6808439b61e80fe5ee8b48 (patch)
treee3e40f76f07d429c8fbec25949d5ccb55a2e210c /giscanner/maintransformer.py
parente194cf780fb13932be2e158d5eb23db737a6e0db (diff)
downloadgobject-introspection-925c3b875861e83d3d6808439b61e80fe5ee8b48.tar.gz
writer: Include documentation and symbol position in source files
Some documentation tool (as hotdoc[0]) need to have information about symbol declaration and documentation positions in the source files to be able to do smart indexing (automatically build the documenation index). [0] https://hotdoc.github.io/ Fixes #175
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r--giscanner/maintransformer.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 2103e541..e931fcdb 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -236,6 +236,7 @@ class MainTransformer(object):
block = self._blocks.get(section_name)
if block and block.description:
node.doc = block.description
+ node.doc_position = block.position
if isinstance(node, (ast.Class, ast.Interface)):
for prop in node.properties:
self._apply_annotations_property(node, prop)
@@ -693,6 +694,7 @@ class MainTransformer(object):
if tag and tag.description:
node.doc = tag.description
+ node.doc_position = tag.position
if ANN_SKIP in annotations:
node.skip = True
@@ -710,6 +712,7 @@ class MainTransformer(object):
if block.description:
node.doc = block.description
+ node.doc_position = block.position
since_tag = block.tags.get(TAG_SINCE)
if since_tag is not None:
@@ -859,6 +862,7 @@ class MainTransformer(object):
if type_annotation:
field.type = self._transformer.create_type_from_user_string(type_annotation[0])
field.doc = tag.description
+ field.doc_position = tag.position
try:
self._adjust_container_type(parent, field, tag.annotations)
except AttributeError as ex:
@@ -936,6 +940,7 @@ class MainTransformer(object):
param = block.params.get(m.symbol, None)
if param and param.description:
m.doc = param.description
+ m.doc_position = param.position
def _pass_read_annotations2(self, node, chain):
if isinstance(node, ast.Function):