diff mbox series

[net-next,v1,4/4] doc: netlink: Fix op pre and post fields in generated .rst

Message ID 20240528140652.9445-5-donald.hunter@gmail.com (mailing list archive)
State Accepted
Commit 9104feed4c6454b9a720e7e11047be7e5cd83487
Delegated to: Netdev Maintainers
Headers show
Series doc: netlink: Fixes for ynl doc generator | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; GEN HAS DIFF 1 file changed, 1 insertion(+);
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-29--21-00 (tests: 1041)

Commit Message

Donald Hunter May 28, 2024, 2:06 p.m. UTC
The generated .rst has pre and post headings without any values, e.g.
here:

https://docs.kernel.org/6.9/networking/netlink_spec/dpll.html#device-id-get

Emit keys and values in the generated .rst

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
---
 tools/net/ynl/ynl-gen-rst.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Breno Leitao May 28, 2024, 2:25 p.m. UTC | #1
On Tue, May 28, 2024 at 03:06:52PM +0100, Donald Hunter wrote:
> The generated .rst has pre and post headings without any values, e.g.
> here:
> 
> https://docs.kernel.org/6.9/networking/netlink_spec/dpll.html#device-id-get
> 
> Emit keys and values in the generated .rst
> 
> Signed-off-by: Donald Hunter <donald.hunter@gmail.com>

Reviwed-by: Breno Leitao <leitao@debian.org>
Jakub Kicinski May 30, 2024, 1:10 a.m. UTC | #2
On Tue, 28 May 2024 15:06:52 +0100 Donald Hunter wrote:
> The generated .rst has pre and post headings without any values, e.g.
> here:
> 
> https://docs.kernel.org/6.9/networking/netlink_spec/dpll.html#device-id-get
> 
> Emit keys and values in the generated .rst

I think your patch still stands (in case there is more such attrs) but
for pre and post in particular - we can hide them completely. They are
annotations used only by the kernel code gen, there's no need to
display them in the docs.
Donald Hunter May 30, 2024, 10:42 a.m. UTC | #3
Jakub Kicinski <kuba@kernel.org> writes:

> On Tue, 28 May 2024 15:06:52 +0100 Donald Hunter wrote:
>> The generated .rst has pre and post headings without any values, e.g.
>> here:
>> 
>> https://docs.kernel.org/6.9/networking/netlink_spec/dpll.html#device-id-get
>> 
>> Emit keys and values in the generated .rst
>
> I think your patch still stands (in case there is more such attrs) but
> for pre and post in particular - we can hide them completely. They are
> annotations used only by the kernel code gen, there's no need to
> display them in the docs.

Yep, I wondered about that. I'll look at suppressing pre and post in a
followup.
diff mbox series

Patch

diff --git a/tools/net/ynl/ynl-gen-rst.py b/tools/net/ynl/ynl-gen-rst.py
index a957725b20dc..6c56d0d726b4 100755
--- a/tools/net/ynl/ynl-gen-rst.py
+++ b/tools/net/ynl/ynl-gen-rst.py
@@ -156,7 +156,10 @@  def parse_do(do_dict: Dict[str, Any], level: int = 0) -> str:
     lines = []
     for key in do_dict.keys():
         lines.append(rst_paragraph(bold(key), level + 1))
-        lines.append(parse_do_attributes(do_dict[key], level + 1) + "\n")
+        if key in ['request', 'reply']:
+            lines.append(parse_do_attributes(do_dict[key], level + 1) + "\n")
+        else:
+            lines.append(headroom(level + 2) + do_dict[key] + "\n")
 
     return "\n".join(lines)