[PATCH 0/2] RFC: Automatic :c:func: annotation in the sphinx build

From: Jonathan Corbet
Date: Thu Apr 25 2019 - 16:01:44 EST


There have been (justified) complaints that writing function() as
:c:func:`function()` in RST documents is obnoxious for both writers and
readers. The following patch adds an extension to the sphinx build to
add this annotation automatically instead. As is always the case,
recognizing "function()" is easy; recognizing the places where we should
*not* mangle things is harder.

Patch #2 removes all of the :c:func: annotations from xarray.rst - over
150 of them - to highlight the difference. The only change in the output
is cross references added for a couple of functions that were not annotated
in the original version.

This adds some processing during the docs build, but my attempts to
measure the slowdown showed that it is less than the noise between
builds.

The output from a full docs build with these patches applied can be
seen at https://static.lwn.net/kerneldoc/.

Jonathan Corbet (2):
Docs: An initial automarkup extension for sphinx
docs: remove :c:func: annotations from xarray.rst

Documentation/conf.py | 3 +-
Documentation/core-api/xarray.rst | 270 ++++++++++++++---------------
Documentation/sphinx/automarkup.py | 90 ++++++++++
3 files changed, 227 insertions(+), 136 deletions(-)
create mode 100644 Documentation/sphinx/automarkup.py

--
2.21.0