Re: [PATCH] docs: automarkup: Move common logic to add and resolve xref to helper

From: Nícolas F. R. A. Prado
Date: Mon Apr 07 2025 - 16:03:07 EST


On Mon, Apr 07, 2025 at 11:42:03AM -0400, Nícolas F. R. A. Prado wrote:
> Several of the markup functions contain the same code, calling into
> sphinx's pending_xref and resolve_xref functions to add and resolve a
> cross-reference, with only a few of the parameters changed (domain,
> reference type, markup content). Move this logic to its own function and
> reuse it in the markup functions.
>
> No functional change.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>
> ---
> Documentation/sphinx/automarkup.py | 78 ++++++++++----------------------------
> 1 file changed, 20 insertions(+), 58 deletions(-)
>
> diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/automarkup.py
> index ecf54d22e9dc6ab459a91fde580c1cf161f054ed..8b129835e521428c0bafdc1584c8ce69252a668d 100644
> --- a/Documentation/sphinx/automarkup.py
> +++ b/Documentation/sphinx/automarkup.py
> @@ -128,13 +128,11 @@ def note_failure(target):
> # own C role, but both match the same regex, so we try both.
> #
> def markup_func_ref_sphinx3(docname, app, match):
> - cdom = app.env.domains['c']
> #
> # Go through the dance of getting an xref out of the C domain
> #

I just noticed I missed these comments, they refer to the code that was moved to
the helper. I'll delete them in the markup functions for v2.

Thanks,
Nícolas