Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'doc-netlink-fixes-for-ynl-doc-generator'

Donald Hunter says:

====================
doc: netlink: Fixes for ynl doc generator

Several fixes to ynl-gen-rst to resolve issues that can be seen
in:

https://docs.kernel.org/6.10-rc1/networking/netlink_spec/dpll.html#device-id-get
https://docs.kernel.org/6.10-rc1/networking/netlink_spec/dpll.html#lock-status

In patch 2, by not using 'sanitize' for op docs, any formatting in the
.yaml gets passed straight through to the generated .rst which means
that basic rst (also markdown compatible) list formatting can be used in
the .yaml
====================

Link: https://lore.kernel.org/r/20240528140652.9445-1-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+10 -4
+1
Documentation/netlink/specs/dpll.yaml
··· 479 479 name: pin-get 480 480 doc: | 481 481 Get list of pins and its attributes. 482 + 482 483 - dump request without any attributes given - list all the pins in the 483 484 system 484 485 - dump request with target dpll - list all the pins registered with
+9 -4
tools/net/ynl/ynl-gen-rst.py
··· 49 49 def sanitize(text: str) -> str: 50 50 """Remove newlines and multiple spaces""" 51 51 # This is useful for some fields that are spread across multiple lines 52 - return str(text).replace("\n", "").strip() 52 + return str(text).replace("\n", " ").strip() 53 53 54 54 55 55 def rst_fields(key: str, value: str, level: int = 0) -> str: ··· 156 156 lines = [] 157 157 for key in do_dict.keys(): 158 158 lines.append(rst_paragraph(bold(key), level + 1)) 159 - lines.append(parse_do_attributes(do_dict[key], level + 1) + "\n") 159 + if key in ['request', 'reply']: 160 + lines.append(parse_do_attributes(do_dict[key], level + 1) + "\n") 161 + else: 162 + lines.append(headroom(level + 2) + do_dict[key] + "\n") 160 163 161 164 return "\n".join(lines) 162 165 ··· 175 172 176 173 def parse_operations(operations: List[Dict[str, Any]], namespace: str) -> str: 177 174 """Parse operations block""" 178 - preprocessed = ["name", "doc", "title", "do", "dump"] 175 + preprocessed = ["name", "doc", "title", "do", "dump", "flags"] 179 176 linkable = ["fixed-header", "attribute-set"] 180 177 lines = [] 181 178 182 179 for operation in operations: 183 180 lines.append(rst_section(namespace, 'operation', operation["name"])) 184 - lines.append(rst_paragraph(sanitize(operation["doc"])) + "\n") 181 + lines.append(rst_paragraph(operation["doc"]) + "\n") 185 182 186 183 for key in operation.keys(): 187 184 if key in preprocessed: ··· 191 188 if key in linkable: 192 189 value = rst_ref(namespace, key, value) 193 190 lines.append(rst_fields(key, value, 0)) 191 + if 'flags' in operation: 192 + lines.append(rst_fields('flags', rst_list_inline(operation['flags']))) 194 193 195 194 if "do" in operation: 196 195 lines.append(rst_paragraph(":do:", 0))