]> git.ipfire.org Git - thirdparty/qemu.git/commit
docs/sphinx: Add new hxtool Sphinx extension
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 24 Jan 2020 16:26:01 +0000 (16:26 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 3 Feb 2020 10:46:32 +0000 (10:46 +0000)
commit6803d6e9a7d951cd65bbdd88bfe6f8a921c95f54
tree0740ed57be6408d22c2f4c43070c639bdd7b72da
parentb0cecc0d65ec7c4c06cfd987e79eab1a0afee39b
docs/sphinx: Add new hxtool Sphinx extension

Some of our documentation includes sections which are created
by assembling fragments of texinfo from a .hx source file into
a .texi file, which is then included from qemu-doc.texi or
qemu-img.texi.

For Sphinx, rather than creating a file to include, the most natural
way to handle this is to have a small custom Sphinx extension which
reads the .hx file and process it.  So instead of:
 * makefile produces foo.texi from foo.hx
 * qemu-doc.texi says '@include foo.texi'
we have:
 * qemu-doc.rst says 'hxtool-doc:: foo.hx'
 * the Sphinx extension for hxtool has code that runs to handle that
   Sphinx directive which reads the .hx file and emits the appropriate
   documentation contents

This is pretty much the same way the kerneldoc extension works right
now. It also has the advantage that it should work for third-party
services like readthedocs that expect to build the docs directly with
sphinx rather than by invoking our makefiles.

In this commit we implement the hxtool extension.

Note that syntax errors in the rST fragments will be correctly
reported to the user with the filename and line number within the
hx file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20200124162606.8787-4-peter.maydell@linaro.org
docs/conf.py
docs/sphinx/hxtool.py [new file with mode: 0644]