qapi: Allow documentation for features

Features will be documented in a new part introduced by a "Features:"
line, after arguments and before named sections.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-6-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Kevin Wolf 2019-06-06 17:38:01 +02:00 committed by Markus Armbruster
parent 03bf06bdc1
commit f3ed93d545
2 changed files with 51 additions and 4 deletions

View file

@ -182,6 +182,17 @@ def texi_members(doc, what, base, variants, member_func):
return '\n@b{%s:}\n@table @asis\n%s@end table\n' % (what, items)
def texi_features(doc):
"""Format the table of features"""
items = ''
for section in doc.features.values():
desc = texi_format(section.text)
items += '@item @code{%s}\n%s' % (section.name, desc)
if not items:
return ''
return '\n@b{Features:}\n@table @asis\n%s@end table\n' % (items)
def texi_sections(doc, ifcond):
"""Format additional sections following arguments"""
body = ''
@ -201,6 +212,7 @@ def texi_entity(doc, what, ifcond, base=None, variants=None,
member_func=texi_member):
return (texi_body(doc)
+ texi_members(doc, what, base, variants, member_func)
+ texi_features(doc)
+ texi_sections(doc, ifcond))