Skip to content

Commit

Permalink
qapi2texi: Fix up output around #optional
Browse files Browse the repository at this point in the history
We use tag #optional to mark optional members, like this:

    # @name: #optional The name of the guest

texi_body() strips #optional, but not whitespace around it.  For the
above, we get in qemu-qmp-qapi.texi

    @item @code{'name'} (optional)
     The name of the guest
    @EnD table

The extra space can lead to artifacts in output, e.g in
qemu-qmp-ref.7.pod

    =item C<'name'> (optional)

     The name of the guest

and then in qemu-qmp-ref.7

    .IX Item "name (optional)"
    .Vb 1
    \& The name of the guest
    .Ve

instead of intended plain

    .IX Item "name (optional)"
    The name of the guest

Get rid of these artifacts by removing whitespace around #optional
along with it.

This turns three minus signs in qapi-schema.json into markup, because
they're now at the beginning of the line.  Drop them, they're unwanted
there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1489582656-31133-11-git-send-email-armbru@redhat.com>
  • Loading branch information
Markus Armbruster committed Mar 16, 2017
1 parent 4815374 commit 42bebcc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions qapi-schema.json
Expand Up @@ -3779,11 +3779,11 @@
#
# @dstport: #optional destination port - mandatory for udp, optional for ip
#
# @ipv6: #optional - force the use of ipv6
# @ipv6: #optional force the use of ipv6
#
# @udp: #optional - use the udp version of l2tpv3 encapsulation
# @udp: #optional use the udp version of l2tpv3 encapsulation
#
# @cookie64: #optional - use 64 bit coookies
# @cookie64: #optional use 64 bit coookies
#
# @counter: #optional have sequence counter
#
Expand Down
3 changes: 2 additions & 1 deletion scripts/qapi2texi.py
Expand Up @@ -137,7 +137,8 @@ def texi_body(doc):
desc = str(section)
opt = ''
if "#optional" in desc:
desc = desc.replace("#optional", "")
desc = re.sub(r'^ *#optional *\n?|\n? *#optional *$|#optional',
'', desc)
opt = ' (optional)'
body += "@item @code{'%s'}%s\n%s\n" % (arg, opt,
texi_format(desc))
Expand Down

0 comments on commit 42bebcc

Please sign in to comment.