summaryrefslogtreecommitdiff
path: root/giscanner/annotationparser.py
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-08-12 06:01:56 -0400
committerColin Walters <walters@verbum.org>2011-08-13 04:17:00 -0400
commitd437ae4ae95bada1305c6b720bb7eb207c7122bf (patch)
tree22af2fab24b0fffdf70bff272525ae61f2cd2693 /giscanner/annotationparser.py
parentc4c1de663f0c42875d5dd029d910d6c37e90ec8a (diff)
downloadgobject-introspection-d437ae4ae95bada1305c6b720bb7eb207c7122bf.tar.gz
scanner: Don't throw away blank lines in the docs
For generating documentation, we actually want to preserve these. https://bugzilla.gnome.org/show_bug.cgi?id=656389
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r--giscanner/annotationparser.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index ac6430d6..0d7672e4 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -492,13 +492,20 @@ class AnnotationParser(object):
lineno = 2
for line in comment[pos+1:].split('\n'):
line = line.lstrip()
- if (not line.startswith('*') or
- self.WHITESPACE_RE.match(line[1:])):
+ if not line.startswith('*'):
+ lineno += 1
+ continue
+ is_whitespace = self.WHITESPACE_RE.match(line[1:]) is not None
+ if parsing_parameters and is_whitespace:
# As soon as we find a line that's just whitespace,
# we're done parsing the parameters.
parsing_parameters = False
lineno += 1
continue
+ elif is_whitespace:
+ comment_lines.append('')
+ lineno += 1
+ continue
line = line[1:].lstrip()
@@ -576,7 +583,7 @@ class AnnotationParser(object):
elif (not is_parameter):
comment_lines.append(line)
lineno += 1
- block.comment = '\n'.join(comment_lines)
+ block.comment = '\n'.join(comment_lines).strip()
block.validate()
self._blocks[block.name] = block