giscanner: fix DocBlock().comment
authorDieter Verfaillie <dieterv@optionexplicit.be>
Mon, 29 Oct 2012 07:32:08 +0000 (08:32 +0100)
committerDieter Verfaillie <dieterv@optionexplicit.be>
Wed, 28 Nov 2012 20:31:23 +0000 (21:31 +0100)
If there is no comment block description, DocBlock().comment
should be None. This results in the removal of unneeded blank
lines in the output of DocBlock().to_gtk_doc and hence the .c
files generated by misc/update-glib-annotations.py

https://bugzilla.gnome.org/show_bug.cgi?id=688897

gir/gio-2.0.c
gir/glib-2.0.c
gir/gobject-2.0.c
giscanner/annotationparser.py
giscanner/maintransformer.py

index 1c64ec1..0ebadc7 100644 (file)
  * @title: GTlsBackend
  * @short_description: TLS backend implementation
  * @include: gio/gio.h
- *
- *
  */
 
 
index 51805c4..24ed46e 100644 (file)
  * SECTION:shell
  * @title: Shell-related Utilities
  * @short_description: shell-like commandline handling
- *
- *
  */
 
 
  * SECTION:spawn
  * @Short_description: process launching
  * @Title: Spawning Processes
- *
- *
  */
 
 
 /**
  * g_io_channel_error_quark:
  *
- *
- *
  * Returns: the quark used as %G_IO_CHANNEL_ERROR
  */
 
index dc718ce..5d6f3e5 100644 (file)
  * g_value_peek_pointer:
  * @value: An initialized #GValue structure.
  *
- *
- *
  * Returns: (transfer none): the value contents as pointer. This function asserts that g_value_fits_pointer() returned %TRUE for the passed in value.  This is an internal function introduced mainly for C marshallers.
  */
 
 /**
  * g_variant_get_gtype:
  *
- *
- *
  * Since: 2.24
  * Deprecated: 2.26
  */
index 8c48d0a..393ef38 100644 (file)
@@ -389,9 +389,10 @@ class DocBlock(object):
         lines[0] += options
         for param in self.params.values():
             lines.append(param.to_gtk_doc_param())
-        lines.append('')
-        for l in self.comment.split('\n'):
-            lines.append(l)
+        if self.comment:
+            lines.append('')
+            for l in self.comment.split('\n'):
+                lines.append(l)
         if self.tags:
             lines.append('')
             for tag in self.tags.values():
@@ -1105,8 +1106,6 @@ class AnnotationParser(object):
         # intended. Strip those.
         if comment_block.comment:
             comment_block.comment = comment_block.comment.strip()
-        else:
-            comment_block.comment = ''
 
         for tag in comment_block.tags.values():
             self._clean_comment_block_part(tag)
index 34d153b..67168d6 100644 (file)
@@ -225,7 +225,7 @@ usage is void (*_gtk_reserved1)(void);"""
             section_name = 'SECTION:' + name.lower()
             block = self._blocks.get(section_name)
             if block:
-                node.doc = block.comment
+                node.doc = block.comment if block.comment else ''
         if isinstance(node, (ast.Class, ast.Interface)):
             for prop in node.properties:
                 self._apply_annotations_property(node, prop)
@@ -600,7 +600,7 @@ usage is void (*_gtk_reserved1)(void);"""
         if block is None:
             return
 
-        node.doc = block.comment
+        node.doc = block.comment if block.comment else ''
 
         since_tag = block.get_tag(TAG_SINCE)
         if since_tag is not None: