diff options
| author | John Snow <jsnow@redhat.com> | 2025-03-10 23:42:24 -0400 |
|---|---|---|
| committer | Markus Armbruster <armbru@redhat.com> | 2025-03-11 10:10:57 +0100 |
| commit | ef137a224192cf145c8ae207fe96fd77b63596a9 (patch) | |
| tree | 32607dc43f6ba07508a86adb23a02fb84d63c4ba /docs/conf.py | |
| parent | 6a41330206e0df32b93c371b551f89d393eda2c3 (diff) | |
| download | focaccia-qemu-ef137a224192cf145c8ae207fe96fd77b63596a9.tar.gz focaccia-qemu-ef137a224192cf145c8ae207fe96fd77b63596a9.zip | |
docs/qapi-domain: add warnings for malformed field lists
Normally, Sphinx will silently fall back to its standard field list processing if it doesn't match one of your defined fields. A lot of the time, that's not what we want - we want to be warned if we goof something up. For instance, the canonical argument field list form is: :arg type name: descr This form is captured by Sphinx and transformed so that the field label will become "Arguments:". It's possible to omit the type name and descr and still have it be processed correctly. However, if you omit the type name, Sphinx no longer recognizes it: :arg: this is not recognized. This will turn into an arbitrary field list entry whose label is "Arg:", and it otherwise silently fails. You may also see failures for doing things like using :values: instead of :value:, or :errors: instead of :error:, and so on. It's also case sensitive, and easy to trip up. Add a validator that guarantees all field list entries that are the direct child of an ObjectDescription use only recognized forms of field lists, and emit a warning (treated as error by default in most build configurations) whenever we detect one that is goofed up. However, there's still benefit to allowing arbitrary fields -- they are after all not a Sphinx invention, but perfectly normal docutils syntax. Create an allow list for known spellings we don't mind letting through, but warn against anything else. Signed-off-by: John Snow <jsnow@redhat.com> Message-ID: <20250311034303.75779-27-jsnow@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'docs/conf.py')
| -rw-r--r-- | docs/conf.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py index 49d9de894c..a3f9fa63d9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -153,6 +153,15 @@ rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n" with open(os.path.join(qemu_docdir, 'defs.rst.inc')) as f: rst_epilog += f.read() + +# Normally, the QAPI domain is picky about what field lists you use to +# describe a QAPI entity. If you'd like to use arbitrary additional +# fields in source documentation, add them here. +qapi_allowed_fields = { + "see also", +} + + # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for |