diff options
author | Stef Walter <stefw@gnome.org> | 2013-01-30 11:13:38 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-01-31 10:00:55 +0100 |
commit | 3202978060b8352633ad484199ce51d4b81ffdc3 (patch) | |
tree | 820962e7482a88d00ffd1d89ff98cef31bf27bb1 /gio/gdbus-2.0/codegen/codegen_docbook.py | |
parent | 11e208f9d61156c1bbe4ff9f3ca3f24827246976 (diff) |
gdbus: Don't output invalid nested <para> docbook tags
Fix gdbus-codegen so it no longer outputs tags like
<para><para>Text</para></para>
https://bugzilla.gnome.org/show_bug.cgi?id=692865
Diffstat (limited to 'gio/gdbus-2.0/codegen/codegen_docbook.py')
-rw-r--r-- | gio/gdbus-2.0/codegen/codegen_docbook.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gio/gdbus-2.0/codegen/codegen_docbook.py b/gio/gdbus-2.0/codegen/codegen_docbook.py index bca17c7a7..94e07ed49 100644 --- a/gio/gdbus-2.0/codegen/codegen_docbook.py +++ b/gio/gdbus-2.0/codegen/codegen_docbook.py @@ -172,18 +172,18 @@ class DocbookCodeGenerator: self.out.write('<programlisting>\n') 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('%s\n'%(self.expand_paras(m.doc_string, True))) 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(' <listitem>%s</listitem>\n'%(self.expand_paras(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(' <listitem>%s</listitem>\n'%(self.expand_paras(a.doc_string, True))) self.out.write('</varlistentry>\n'%()) self.out.write('</variablelist>\n') if len(m.since) > 0: @@ -199,13 +199,13 @@ class DocbookCodeGenerator: self.out.write('<programlisting>\n') 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('%s\n'%(self.expand_paras(s.doc_string, True))) 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(' <listitem>%s</listitem>\n'%(self.expand_paras(a.doc_string, True))) self.out.write('</varlistentry>\n'%()) self.out.write('</variablelist>\n') if len(s.since) > 0: @@ -221,7 +221,7 @@ class DocbookCodeGenerator: self.out.write('<programlisting>\n') self.print_property_prototype(i, p, in_synopsis=False) self.out.write('</programlisting>\n') - self.out.write('<para>%s</para>\n'%(self.expand(p.doc_string, True))) + self.out.write('%s\n'%(self.expand_paras(p.doc_string, True))) if len(p.since) > 0: self.out.write('<para role="since">Since %s</para>\n'%(p.since)) if p.deprecated: @@ -240,6 +240,12 @@ class DocbookCodeGenerator: s = re.sub('%[a-zA-Z0-9_]*', lambda m: '<constant>' + m.group(0)[1:] + '</constant>', s) return s + def expand_paras(self, s, expandParamsAndConstants): + s = self.expand(s, expandParamsAndConstants).strip() + if not s.startswith("<para"): + s = "<para>%s</para>" % s + return s + def generate_expand_dicts(self): self.expand_member_dict = {} self.expand_iface_dict = {} @@ -292,7 +298,7 @@ class DocbookCodeGenerator: self.out.write('<refsect1 role="desc" id="gdbus-interface-%s">\n'%(utils.dots_to_hyphens(i.name))) self.out.write(' <title role="desc.title">Description</title>\n'%()) - self.out.write(' <para>%s</para>\n'%(self.expand(i.doc_string, True))) + self.out.write(' %s\n'%(self.expand_paras(i.doc_string, True))) if len(i.since) > 0: self.out.write(' <para role="since">Since %s</para>\n'%(i.since)) if i.deprecated: |