Re: [PATCH v5 03/15] tools: ynl_gen_rst.py: create a top-level reference

Donald Hunter
2025-06-17T13:00:00Z

Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:

> Currently, rt documents are referred with:
>
> Documentation/userspace-api/netlink/netlink-raw.rst: :doc:`rt-link<../../networking/netlink_spec/rt-link>`
> Documentation/userspace-api/netlink/netlink-raw.rst: :doc:`tc<../../networking/netlink_spec/tc>`
> Documentation/userspace-api/netlink/netlink-raw.rst: :doc:`tc<../../networking/netlink_spec/tc>`
>
> that's hard to maintain, and may break if we change the way
> rst files are generated from yaml. Better to use instead a
> reference for the netlink family.
>
> So, add a netlink-<foo> reference to all generated docs.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

I would still prefer to see patches 3 and 4 merged since they are part
of the same fix.

> ---
> tools/net/ynl/pyynl/ynl_gen_rst.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/net/ynl/pyynl/ynl_gen_rst.py b/tools/net/ynl/pyynl/ynl_gen_rst.py
> index 0cb6348e28d3..7bfb8ceeeefc 100755
> --- a/tools/net/ynl/pyynl/ynl_gen_rst.py
> +++ b/tools/net/ynl/pyynl/ynl_gen_rst.py
> @@ -314,10 +314,11 @@ def parse_yaml(obj: Dict[str, Any]) -> str:
>
> # Main header
>
> - lines.append(rst_header())
> -
> family = obj['name']
>
> + lines.append(rst_header())
> + lines.append(rst_label("netlink-" + family))
> +
> title = f"Family ``{family}`` netlink specification"
> lines.append(rst_title(title))
> lines.append(rst_paragraph(".. contents:: :depth: 3\n"))