[glib] gdbus: Don't output invalid empty <variablelist> tags



commit 11e208f9d61156c1bbe4ff9f3ca3f24827246976
Author: Stef Walter <stefw gnome org>
Date:   Wed Jan 30 11:07:52 2013 +0100

    gdbus: Don't output invalid empty <variablelist> tags
    
    Docbook doesn't allow an empty <variablelist> and so the docbook
    output from gdbus-codegen is invalid when a method/signal has
    no arguments.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692865

 gio/gdbus-2.0/codegen/codegen_docbook.py |   40 +++++++++++++++--------------
 1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen_docbook.py b/gio/gdbus-2.0/codegen/codegen_docbook.py
index 00581f1..bca17c7 100644
--- a/gio/gdbus-2.0/codegen/codegen_docbook.py
+++ b/gio/gdbus-2.0/codegen/codegen_docbook.py
@@ -173,18 +173,19 @@ class DocbookCodeGenerator:
         self.print_method_prototype(i, m, in_synopsis=False)
         self.out.write('</programlisting>\n')
         self.out.write('<para>%s</para>\n'%(self.expand(m.doc_string, True)))
-        self.out.write('<variablelist role="params">\n')
-        for a in m.in_args:
-            self.out.write('<varlistentry>\n'%())
-            self.out.write('  <term><literal>IN %s <parameter>%s</parameter></literal>:</term>\n'%(a.signature, a.name))
-            self.out.write('  <listitem><para>%s</para></listitem>\n'%(self.expand(a.doc_string, True)))
-            self.out.write('</varlistentry>\n'%())
-        for a in m.out_args:
-            self.out.write('<varlistentry>\n'%())
-            self.out.write('  <term><literal>OUT %s <parameter>%s</parameter></literal>:</term>\n'%(a.signature, a.name))
-            self.out.write('  <listitem><para>%s</para></listitem>\n'%(self.expand(a.doc_string, True)))
-            self.out.write('</varlistentry>\n'%())
-        self.out.write('</variablelist>\n')
+        if m.in_args or m.out_args:
+            self.out.write('<variablelist role="params">\n')
+            for a in m.in_args:
+                self.out.write('<varlistentry>\n'%())
+                self.out.write('  <term><literal>IN %s <parameter>%s</parameter></literal>:</term>\n'%(a.signature, a.name))
+                self.out.write('  <listitem><para>%s</para></listitem>\n'%(self.expand(a.doc_string, True)))
+                self.out.write('</varlistentry>\n'%())
+            for a in m.out_args:
+                self.out.write('<varlistentry>\n'%())
+                self.out.write('  <term><literal>OUT %s <parameter>%s</parameter></literal>:</term>\n'%(a.signature, a.name))
+                self.out.write('  <listitem><para>%s</para></listitem>\n'%(self.expand(a.doc_string, True)))
+                self.out.write('</varlistentry>\n'%())
+            self.out.write('</variablelist>\n')
         if len(m.since) > 0:
             self.out.write('<para role="since">Since %s</para>\n'%(m.since))
         if m.deprecated:
@@ -199,13 +200,14 @@ class DocbookCodeGenerator:
         self.print_signal_prototype(i, s, in_synopsis=False)
         self.out.write('</programlisting>\n')
         self.out.write('<para>%s</para>\n'%(self.expand(s.doc_string, True)))
-        self.out.write('<variablelist role="params">\n')
-        for a in s.args:
-            self.out.write('<varlistentry>\n'%())
-            self.out.write('  <term><literal>%s <parameter>%s</parameter></literal>:</term>\n'%(a.signature, a.name))
-            self.out.write('  <listitem><para>%s</para></listitem>\n'%(self.expand(a.doc_string, True)))
-            self.out.write('</varlistentry>\n'%())
-        self.out.write('</variablelist>\n')
+        if s.args:
+            self.out.write('<variablelist role="params">\n')
+            for a in s.args:
+                self.out.write('<varlistentry>\n'%())
+                self.out.write('  <term><literal>%s <parameter>%s</parameter></literal>:</term>\n'%(a.signature, a.name))
+                self.out.write('  <listitem><para>%s</para></listitem>\n'%(self.expand(a.doc_string, True)))
+                self.out.write('</varlistentry>\n'%())
+            self.out.write('</variablelist>\n')
         if len(s.since) > 0:
             self.out.write('<para role="since">Since %s</para>\n'%(s.since))
         if s.deprecated:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]