summary refs log tree commit diff stats
path: root/scripts/qapi/doc.py
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2019-06-06 17:38:01 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-06-12 18:35:57 +0200
commitf3ed93d545297afbf8c67092b84a14037ec380bd (patch)
tree5dd00ac5ff26f6040d41eda1be6aaabbc359b493 /scripts/qapi/doc.py
parent03bf06bdc13c066a4703ab16e767dd91214969e3 (diff)
downloadfocaccia-qemu-f3ed93d545297afbf8c67092b84a14037ec380bd.tar.gz
focaccia-qemu-f3ed93d545297afbf8c67092b84a14037ec380bd.zip
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>
Diffstat (limited to 'scripts/qapi/doc.py')
-rwxr-xr-xscripts/qapi/doc.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py
index 433e9fcbfb..5fc0fc7e06 100755
--- a/scripts/qapi/doc.py
+++ b/scripts/qapi/doc.py
@@ -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))