docs: automarkup.py: Allow automatic cross-reference inside C namespace
authorNícolas F. R. A. Prado <nfraprado@protonmail.com>
Tue, 17 Nov 2020 02:12:01 +0000 (02:12 +0000)
committerJonathan Corbet <corbet@lwn.net>
Mon, 30 Nov 2020 17:54:33 +0000 (10:54 -0700)
commitfb568273c0555097e8955643fa5d054b4e01bfc7
treebb0bb8c6e6273e3055df529684c529c669d553c8
parentf59c4966d8508671ae3a990396a9da91f85ad75b
docs: automarkup.py: Allow automatic cross-reference inside C namespace

Sphinx 3.1 introduced namespaces for C cross-references. With this,
each C domain type/function declaration is put inside the namespace that
was active at the time of its declaration.

Add support for automatic cross-referencing inside C namespaces by
checking whether the corresponding source file had a C namespace Sphinx
directive, and if so, try cross-referencing inside of it before going to
the global scope.

This assumes there's only one namespace (if any) per rst file.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Link: https://lore.kernel.org/r/20201117021107.214704-1-nfraprado@protonmail.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Documentation/sphinx/automarkup.py