Documentation: Document the Netlink spec
Subsystems (4)
PATCH 1/1 Documentation: Document the Netlink spec
This is a Sphinx extension that parses the Netlink YAML spec files (Documentation/netlink/specs/), and generates a rst file to be displayed into Documentation pages.
Create a new Documentation/networking/netlink_spec page, and a sub-page for each Netlink spec that needs to be documented, such as ethtool, devlink, netdev, etc.
Create a Sphinx directive extension that reads the YAML spec (located under Documentation/netlink/specs), parses it and returns a RST string that is inserted where the Sphinx directive was called.
--- Documentation/conf.py | 2 +- Documentation/networking/index.rst | 1 + .../networking/netlink_spec/devlink.rst | 9 + .../networking/netlink_spec/ethtool.rst | 9 + Documentation/networking/netlink_spec/fou.rst | 9 + .../networking/netlink_spec/handshake.rst | 9 + .../networking/netlink_spec/index.rst | 21 ++ .../networking/netlink_spec/netdev.rst | 9 + .../networking/netlink_spec/ovs_datapath.rst | 9 + .../networking/netlink_spec/ovs_flow.rst | 9 + .../networking/netlink_spec/ovs_vport.rst | 9 + .../networking/netlink_spec/rt_addr.rst | 9 + .../networking/netlink_spec/rt_link.rst | 9 + .../networking/netlink_spec/rt_route.rst | 9 + Documentation/sphinx/netlink_spec.py | 283 ++++++++++++++++++ Documentation/sphinx/requirements.txt | 1 + 16 files changed, 406 insertions(+), 1 deletion(-) create mode 100644 Documentation/networking/netlink_spec/devlink.rst create mode 100644 Documentation/networking/netlink_spec/ethtool.rst create mode 100644 Documentation/networking/netlink_spec/fou.rst create mode 100644 Documentation/networking/netlink_spec/handshake.rst create mode 100644 Documentation/networking/netlink_spec/index.rst create mode 100644 Documentation/networking/netlink_spec/netdev.rst create mode 100644 Documentation/networking/netlink_spec/ovs_datapath.rst create mode 100644 Documentation/networking/netlink_spec/ovs_flow.rst create mode 100644 Documentation/networking/netlink_spec/ovs_vport.rst create mode 100644 Documentation/networking/netlink_spec/rt_addr.rst create mode 100644 Documentation/networking/netlink_spec/rt_link.rst create mode 100644 Documentation/networking/netlink_spec/rt_route.rst create mode 100755 Documentation/sphinx/netlink_spec.py
Documentation/conf.py +1 -1
@@ -55,7 +55,7 @@ needs_sphinx = '1.7' extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'kfigure', 'sphinx.ext.ifconfig', 'automarkup', 'maintainers_include', 'sphinx.ext.autosectionlabel', - 'kernel_abi', 'kernel_feat'] + 'kernel_abi', 'kernel_feat', 'netlink_spec'] if major >= 3: if (major > 3) or (minor > 0 or patch >= 2):
Documentation/networking/index.rst +1 -0
@@ -55,6 +55,7 @@ Contents: filter generic-hdlc generic_netlink + netlink_spec/index gen_stats gtp ila
Documentation/networking/netlink_spec/devlink.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================== +Family ``devlink`` netlink specification +======================================== + +.. contents:: + +.. netlink-spec:: devlink.yaml
Documentation/networking/netlink_spec/ethtool.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================== +Family ``ethtool`` netlink specification +======================================== + +.. contents:: + +.. netlink-spec:: ethtool.yaml
Documentation/networking/netlink_spec/fou.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================= +Family ``fou`` netlink specification +======================================= + +.. contents:: + +.. netlink-spec:: fou.yaml
Documentation/networking/netlink_spec/handshake.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================================== +Family ``handshake`` netlink specification +========================================== + +.. contents:: + +.. netlink-spec:: handshake.yaml
Documentation/networking/netlink_spec/index.rst new file +21 -0
@@ -0,0 +1,21 @@ +.. SPDX-License-Identifier: GPL-2.0 + +====================== +Netlink Specifications +====================== + +.. toctree:: + :maxdepth: 2 + + devlink + ethtool + fou + handshake + netdev + ovs_datapath + ovs_flow + ovs_vport + rt_addr + rt_link + rt_route +
Documentation/networking/netlink_spec/netdev.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================= +Family ``netdev`` netlink specification +======================================= + +.. contents:: + +.. netlink-spec:: netdev.yaml
Documentation/networking/netlink_spec/ovs_datapath.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +============================================= +Family ``ovs_datapath`` netlink specification +============================================= + +.. contents:: + +.. netlink-spec:: ovs_datapath.yaml
Documentation/networking/netlink_spec/ovs_flow.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================================= +Family ``ovs_flow`` netlink specification +========================================= + +.. contents:: + +.. netlink-spec:: ovs_flow.yaml
Documentation/networking/netlink_spec/ovs_vport.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================================== +Family ``ovs_vport`` netlink specification +========================================== + +.. contents:: + +.. netlink-spec:: ovs_vport.yaml
Documentation/networking/netlink_spec/rt_addr.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================== +Family ``rt_addr`` netlink specification +======================================== + +.. contents:: + +.. netlink-spec:: rt_addr.yaml
Documentation/networking/netlink_spec/rt_link.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================== +Family ``rt_link`` netlink specification +======================================== + +.. contents:: + +.. netlink-spec:: rt_link.yaml
Documentation/networking/netlink_spec/rt_route.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================================= +Family ``rt_route`` netlink specification +========================================= + +.. contents:: + +.. netlink-spec:: rt_route.yaml
Documentation/sphinx/netlink_spec.py new file +283 -0
283 lines not on this page · raw message
Documentation/sphinx/requirements.txt +1 -0
@@ -1,3 +1,4 @@ # jinja2>=3.1 is not compatible with Sphinx<4.0 jinja2<3.1 Sphinx==2.4.4 +pyyaml
Signature · 1 line
2.34.1
Jakub Kicinski
maintainerQuoted 8 lines · On Fri, 3 Nov 2023 06:56:22 -0700 Breno Leitao wrote:
This is a Sphinx extension that parses the Netlink YAML spec files (
Documentation/netlink/specs/), and generates a rst file to be displayed into Documentation pages.Create a new
Documentation/networking/netlink_specpage, and a sub-page for each Netlink spec that needs to be documented, such as ethtool, devlink, netdev, etc.
Quoted 7 lines
Create a Sphinx directive extension that reads the YAML spec (located under
Documentation/netlink/specs), parses it and returns a RST string that is inserted where the Sphinx directive was called.+=======================================
+Family ``fou`` netlink specification
+=======================================
nit: bad length of the ==== marker lines
Quoted 1 line
+def
parse_attributes_set(entries: List[Dict[str, Any]])-> str:
I'd rename to parse_attr_sets (plural sets).
Documentation/sphinx/netlink_spec.py line 196
Quoted 7 lines
Documentation/sphinx/netlink_spec.py new file +7
-0+ """Parse attribute from attribute-set""" + preprocessed = ["name", "type"] + ignored = ["checks"] + lines = [] + + for entry in entries: + lines.append(rst_bullet(bold(entry["name"])))
This would be better as subsubtitle.
Documentation/sphinx/netlink_spec.py line 204
Quoted 8 lines
Documentation/sphinx/netlink_spec.py new file +8
-0+ for attr in entry["attributes"]: + type_ = attr.get("type") + attr_line = bold(attr["name"]) + if type_: + # Add the attribute type in the same line + attr_line += f" ({inline(type_)})" + + lines.append(rst_bullet(attr_line, 2))
And this actually, probably also a sub^3-title, because we'll want to link to the specific attributes sooner or later. And linking to bullet points isn't a thing (AFAIU?)
Quoted 11 lines · Breno Leitao
This is a Sphinx extension that parses the Netlink YAML spec files (
Documentation/netlink/specs/), and generates a rst file to be displayed into Documentation pages.Create a new
Documentation/networking/netlink_specpage, and a sub-page for each Netlink spec that needs to be documented, such as ethtool, devlink, netdev, etc.Create a Sphinx directive extension that reads the YAML spec (located under
Documentation/netlink/specs), parses it and returns a RST string that is inserted where the Sphinx directive was called.
This is great! Looks like I need to fill in some missing docs in the specs I have contributed.
I wonder if the generated .rst content can be adjusted to improve the resulting HTML.
There are a couple of places where paragraph text is indented and I don't think it needs to be, e.g. the 'Summary' doc.
A lot of the .rst content seems to be over-indented which causes blockquote tags to be generated in the HTML. That combined with a mixture of bullets and definition lists at the same indentation level seems to produce HTML with inconsistent indentation.
I quickly hacked the diff below to see if it would improve the HTML rendering. I think the HTML has fewer odd constructs and the indentation seems better to my eye. My main aim was to ensure that for a given section, each indentation level uses the same construct, whether it be a definition list or a bullet list.
It would be great to generate links from e.g. an attribute-set to its definition.
Did you intentionally leave out the protocol values?
It looks like parse_entries will need to be extended to include the type information for struct members, similar to how attribute sets are shown. I'd be happy to look at this as a follow up patch, unless you get there first.
Thanks,
Donald.
Documentation/sphinx/netlink_spec.py +19 -18
@@ -92,7 +92,7 @@ def parse_mcast_group(mcast_group: List[Dict[str, Any]]) -> str: """Parse 'multicast' group list and return a formatted string""" lines = [] for group in mcast_group: - lines.append(rst_paragraph(group["name"], 1)) + lines.append(rst_bullet(group["name"])) return "\n".join(lines)
@@ -101,7 +101,7 @@ def parse_do(do_dict: Dict[str, Any], level: int = 0) -> str: """Parse 'do' section and return a formatted string""" lines = [] for key in do_dict.keys(): - lines.append(rst_bullet(bold(key), level + 1)) + lines.append(" " + bold(key)) lines.append(parse_do_attributes(do_dict[key], level + 1) + "\n") return "\n".join(lines)
@@ -124,18 +124,19 @@ def parse_operations(operations: List[Dict[str, Any]]) -> str: for operation in operations: lines.append(rst_subsubtitle(operation["name"])) lines.append(rst_paragraph(operation["doc"]) + "\n") - if "do" in operation: - lines.append(rst_paragraph(bold("do"), 1)) - lines.append(parse_do(operation["do"], 1)) - if "dump" in operation: - lines.append(rst_paragraph(bold("dump"), 1)) - lines.append(parse_do(operation["dump"], 1)) for key in operation.keys(): if key in preprocessed: # Skip the special fields continue - lines.append(rst_fields(key, operation[key], 1)) + lines.append(rst_fields(key, operation[key], 0)) + + if "do" in operation: + lines.append(rst_paragraph(":do:", 0)) + lines.append(parse_do(operation["do"], 0)) + if "dump" in operation: + lines.append(rst_paragraph(":dump:", 0)) + lines.append(parse_do(operation["dump"], 0)) # New line after fields lines.append("\n")
@@ -150,7 +151,7 @@ def parse_entries(entries: List[Dict[str, Any]], level: int) -> str: if isinstance(entry, dict): # entries could be a list or a dictionary lines.append( - rst_fields(entry.get("name"), sanitize(entry.get("doc")), level) + rst_fields(entry.get("name"), sanitize(entry.get("doc") or ""), level) ) elif isinstance(entry, list): lines.append(rst_list_inline(entry, level))
@@ -172,16 +173,16 @@ def parse_definitions(defs: Dict[str, Any]) -> str: for k in definition.keys(): if k in preprocessed + ignored: continue - lines.append(rst_fields(k, sanitize(definition[k]), 1)) + lines.append(rst_fields(k, sanitize(definition[k]), 0)) # Field list needs to finish with a new line lines.append("\n") if "entries" in definition: - lines.append(rst_paragraph(bold("Entries"), 1)) - lines.append(parse_entries(definition["entries"], 2)) + lines.append(rst_paragraph(":entries:", 0)) + lines.append(parse_entries(definition["entries"], 1)) if "members" in definition: - lines.append(rst_paragraph(bold("members"), 1)) - lines.append(parse_entries(definition["members"], 2)) + lines.append(rst_paragraph(":members:", 0)) + lines.append(parse_entries(definition["members"], 1)) return "\n".join(lines)
@@ -201,12 +202,12 @@ def parse_attributes_set(entries: List[Dict[str, Any]]) -> str: # Add the attribute type in the same line attr_line += f" ({inline(type_)})" - lines.append(rst_bullet(attr_line, 2)) + lines.append(rst_bullet(attr_line, 1)) for k in attr.keys(): if k in preprocessed + ignored: continue - lines.append(rst_fields(k, sanitize(attr[k]), 3)) + lines.append(rst_fields(k, sanitize(attr[k]), 2)) lines.append("\n") return "\n".join(lines)
@@ -218,7 +219,7 @@ def parse_yaml(obj: Dict[str, Any]) -> str: # This is coming from the RST lines.append(rst_subtitle("Summary")) - lines.append(rst_paragraph(obj["doc"], 1)) + lines.append(rst_paragraph(obj["doc"], 0)) # Operations lines.append(rst_subtitle("Operations"))
Quoted 6 lines · Donald Hunter
I quickly hacked the diff below to see if it would improve the HTML rendering. I think the HTML has fewer odd constructs and the indentation seems better to my eye. My main aim was to ensure that for a given section, each indentation level uses the same construct, whether it be a definition list or a bullet list.
Or what Jakub said, use more (sub)+titles and fewer bullet lists.
Quoted 28 lines · Donald Hunter
Quoted 11 lines · Breno Leitao
This is a Sphinx extension that parses the Netlink YAML spec files (
Documentation/netlink/specs/), and generates a rst file to be displayed into Documentation pages.Create a new
Documentation/networking/netlink_specpage, and a sub-page for each Netlink spec that needs to be documented, such as ethtool, devlink, netdev, etc.Create a Sphinx directive extension that reads the YAML spec (located under
Documentation/netlink/specs), parses it and returns a RST string that is inserted where the Sphinx directive was called.This is great! Looks like I need to fill in some missing docs in the specs I have contributed.
I wonder if the generated .rst content can be adjusted to improve the resulting HTML.
There are a couple of places where paragraph text is indented and I don't think it needs to be, e.g. the 'Summary' doc.
A lot of the .rst content seems to be over-indented which causes blockquote tags to be generated in the HTML. That combined with a mixture of bullets and definition lists at the same indentation level seems to produce HTML with inconsistent indentation.
Quoted 5 lines
I quickly hacked the diff below to see if it would improve the HTML rendering. I think the HTML has fewer odd constructs and the indentation seems better to my eye. My main aim was to ensure that for a given section, each indentation level uses the same construct, whether it be a definition list or a bullet list.
Thanks for the diff. That makes total sense and I will integrate it in the updated version.
Quoted 4 lines
It would be great to generate links from e.g. an attribute-set to its definition.
Did you intentionally leave out the protocol values?
Yes. This could be done in a follow up patch if necessary.
Quoted 5 lines
It looks like
parse_entrieswill need to be extended to include the type information for struct members, similar to how attribute sets are shown. I'd be happy to look at this as a follow up patch, unless you get there first.
Awesome. That would be appreciate.
Jonathan Corbet
maintainerQuoted 11 lines · Breno Leitao
This is a Sphinx extension that parses the Netlink YAML spec files (
Documentation/netlink/specs/), and generates a rst file to be displayed into Documentation pages.Create a new
Documentation/networking/netlink_specpage, and a sub-page for each Netlink spec that needs to be documented, such as ethtool, devlink, netdev, etc.Create a Sphinx directive extension that reads the YAML spec (located under
Documentation/netlink/specs), parses it and returns a RST string that is inserted where the Sphinx directive was called.
So I finally had a chance to look a bit at this; I have a few impressions.
First of all, if you put something silly into one of the YAML files, it kills the whole docs build, which is ... not desirable:
Quoted 6 lines
Exception occurred:
File "/usr/lib64/python3.11/site-packages/yaml/scanner.py", line 577, infetch_value
raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here
in "/stuff/k/git/kernel/Documentation/netlink/specs/ovs_datapath.yaml", line 14, column 9
That error needs to be caught and handled in some more graceful way.
I do have to wonder, though, whether a sphinx extension is the right way to solve this problem. You're essentially implementing a filter that turns one YAML file into one RST file; might it be better to keep that outside of sphinx as a standalone script, invoked by the Makefile?
Note that I'm asking because I wonder, I'm not saying I would block an extension-based implementation.
Thanks,
jon
Jakub Kicinski
maintainerQuoted 4 lines · On Wed, 08 Nov 2023 13:27:28 -0700 Jonathan Corbet wrote:
I do have to wonder, though, whether a sphinx extension is the right way to solve this problem. You're essentially implementing a filter that turns one YAML file into one RST file; might it be better to keep that outside of sphinx as a standalone script, invoked by the
Makefile?
If we're considering other ways of generating the files - I'd also like to voice a weak preference towards removing the need for the "stub" files.
Get all the docs rendered under Documentation/netlink/ with an auto-generated index.
This way newcomers won't have to remember to add a stub to get the doc rendered. One fewer thing to worry about during review.
Quoted 6 lines · Jakub Kicinski
Quoted 4 lines · On Wed, 08 Nov 2023 13:27:28 -0700 Jonathan Corbet wrote:
I do have to wonder, though, whether a sphinx extension is the right way to solve this problem. You're essentially implementing a filter that turns one YAML file into one RST file; might it be better to keep that outside of sphinx as a standalone script, invoked by the
Makefile?
Quoted 6 lines
If we're considering other ways of generating the files - I'd also like to voice a weak preference towards removing the need for the "stub" files.
Get all the docs rendered under
Documentation/netlink/with an auto-generated index.
FWIW the index could use a toctree glob pattern like we do in Documentation/bpf/maps.rst then it wouldn't need to be auto-generated.
Quoted 2 lines
This way newcomers won't have to remember to add a stub to get the doc rendered. One fewer thing to worry about during review.
Quoted 29 lines · Jonathan Corbet
Quoted 11 lines · Breno Leitao
This is a Sphinx extension that parses the Netlink YAML spec files (
Documentation/netlink/specs/), and generates a rst file to be displayed into Documentation pages.Create a new
Documentation/networking/netlink_specpage, and a sub-page for each Netlink spec that needs to be documented, such as ethtool, devlink, netdev, etc.Create a Sphinx directive extension that reads the YAML spec (located under
Documentation/netlink/specs), parses it and returns a RST string that is inserted where the Sphinx directive was called.So I finally had a chance to look a bit at this; I have a few impressions.
First of all, if you put something silly into one of the YAML files, it kills the whole docs build, which is ... not desirable:
Quoted 6 lines
Exception occurred:
File "/usr/lib64/python3.11/site-packages/yaml/scanner.py", line 577, infetch_value
raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here
in "/stuff/k/git/kernel/Documentation/netlink/specs/ovs_datapath.yaml", line 14, column 9That error needs to be caught and handled in some more graceful way.
Quoted 7 lines
I do have to wonder, though, whether a sphinx extension is the right way to solve this problem. You're essentially implementing a filter that turns one YAML file into one RST file; might it be better to keep that outside of sphinx as a standalone script, invoked by the
Makefile?Note that I'm asking because I wonder, I'm not saying I would block an extension-based implementation.
+1 to this. The .rst generation can then be easily tested independently of the doc build and the stub files could be avoided.
Just a note that last year you offered the opposite guidance:
https://lore.kernel.org/linux-doc/[email protected]/
If the preference now is for standalone scripts invoked by the Makefile then this previous patch might be useful:
https://lore.kernel.org/linux-doc/[email protected]/
It would be good to document the preferred approach to this kind of doc extension and I'd be happy to contribute an 'Extensions' section for contributing.rst in the doc-guide.
Quoted 3 lines
Thanks,
jon
Jonathan Corbet
maintainerQuoted 9 lines · Donald Hunter
Quoted 7 lines · Jonathan Corbet
I do have to wonder, though, whether a sphinx extension is the right way to solve this problem. You're essentially implementing a filter that turns one YAML file into one RST file; might it be better to keep that outside of sphinx as a standalone script, invoked by the
Makefile?Note that I'm asking because I wonder, I'm not saying I would block an extension-based implementation.
Quoted 6 lines
+1 to this. The .rst generation can then be easily tested independently of the doc build and the stub files could be avoided.
Just a note that last year you offered the opposite guidance:
Heh ... I totally forgot about that whole discussion ...
Quoted 8 lines
If the preference now is for standalone scripts invoked by the
Makefilethen this previous patch might be useful:https://lore.kernel.org/linux-doc/[email protected]/
It would be good to document the preferred approach to this kind of doc extension and I'd be happy to contribute an 'Extensions' section for
contributing.rstin the doc-guide.
I think it will vary depending on what we're trying to do, and I think we're still working it out - part of why I expressed some uncertainty this time around.
For something like the kernel-doc or automarkup, where we are modifying existing documents, an extension is the only way to go. In this case, where we are creating new RST files from whole cloth, it's not so clear to me. My feeling (this week at least ;) is that doing it as an extension makes things more complicated without a lot of benefit.
FWIW, if something like this is done as a makefile change, I'd do it a bit differently than your linked patch above. Rather than replicate the command through the file, I'd just add a new target:
netlink_specs:
.../scripts/gen-netlink-rst
htmldocs: netlink_specs
existing stuff here
But that's a detail.
Thanks,
jon
Jakub Kicinski
maintainerQuoted 2 lines · On Thu, 09 Nov 2023 07:12:38 -0700 Jonathan Corbet wrote:
netlink_specs:
.../scripts/gen-netlink-rst
FWIW if we go down that route we probably want to put the script under tools/net/ynl/ and reuse tools/net/ynl/lib/nlspec.py ? It "abstracts away" some basic parsing of the spec, fills in implied attributes etc.
Quoted 33 lines · Jonathan Corbet
Quoted 9 lines · Donald Hunter
Quoted 7 lines · Jonathan Corbet
I do have to wonder, though, whether a sphinx extension is the right way to solve this problem. You're essentially implementing a filter that turns one YAML file into one RST file; might it be better to keep that outside of sphinx as a standalone script, invoked by the
Makefile?Note that I'm asking because I wonder, I'm not saying I would block an extension-based implementation.
Quoted 6 lines
+1 to this. The .rst generation can then be easily tested independently of the doc build and the stub files could be avoided.
Just a note that last year you offered the opposite guidance:
Heh ... I totally forgot about that whole discussion ...
Quoted 8 lines
If the preference now is for standalone scripts invoked by the
Makefilethen this previous patch might be useful:https://lore.kernel.org/linux-doc/[email protected]/
It would be good to document the preferred approach to this kind of doc extension and I'd be happy to contribute an 'Extensions' section for
contributing.rstin the doc-guide.I think it will vary depending on what we're trying to do, and I think we're still working it out - part of why I expressed some uncertainty this time around.
Quoted 5 lines
For something like the kernel-doc or automarkup, where we are modifying existing documents, an extension is the only way to go. In this case, where we are creating new RST files from whole cloth, it's not so clear to me. My feeling (this week at least ;) is that doing it as an extension makes things more complicated without a lot of benefit.
One way or another works for me. Given my experience with both ways, let me share the advantages of boths so we can understand the trade-offs better:
Sphinx extension advantages:
===========================
1) Keep "extensions" uniform and organized, written in the same framework/language (python), using the same enry point, output, etc.
2) Easy to cross reference objects in the whole documentation (not done in this patchset)
3) Same dependencies for all "documentation". I.e, you don't need a dependency (as in python pip requirements.txt) for every "parser" script.
4) Already being used in our infrastructure.
One-off parser advantages:
=========================
1) Total flexibility. You can write the parser in any language.
2) Easier and faster to interate and debug.
3) No need to have a rst stub for every file (as in this patchset). This is a sphinx limitation right now, and *might* go away in the future.
4) Less dependent of sphinx project.
Quoted 11 lines
FWIW, if something like this is done as a makefile change, I'd do it a bit differently than your linked patch above. Rather than replicate the command through the file, I'd just add a new target:
netlink_specs:
.../scripts/gen-netlink-rsthtmldocs:
netlink_specs
existing stuff hereBut that's a detail.
For that, we can't use a sphinx extension, since there is no way (as I understood) from one rst to generate multiple rst.