doc: extensions: kconfig: render menu path
Render the menu path where an option can be found. For example, CONFIG_SPI: (Top) > Device Drivers. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
c980f0490f
commit
d0bb8deaaf
|
@ -333,6 +333,14 @@ def kconfig_build_resources(app: Sphinx) -> None:
|
|||
for sym in sc.syms:
|
||||
choices.append(kconfiglib.expr_str(sym, sc_fmt))
|
||||
|
||||
menupath = ""
|
||||
iternode = node
|
||||
while iternode.parent is not iternode.kconfig.top_node:
|
||||
iternode = iternode.parent
|
||||
menupath = f" > {iternode.prompt[0]}" + menupath
|
||||
|
||||
menupath = "(Top)" + menupath
|
||||
|
||||
filename = node.filename
|
||||
for name, path in module_paths.items():
|
||||
if node.filename.startswith(path):
|
||||
|
@ -356,6 +364,7 @@ def kconfig_build_resources(app: Sphinx) -> None:
|
|||
"choices": choices,
|
||||
"filename": filename,
|
||||
"linenr": node.linenr,
|
||||
"menupath": menupath,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -267,6 +267,7 @@ function renderKconfigEntry(entry) {
|
|||
renderKconfigPropList(props, 'Ranges', entry.ranges, false);
|
||||
renderKconfigPropList(props, 'Choices', entry.choices, false);
|
||||
renderKconfigPropLiteral(props, 'Location', `${entry.filename}:${entry.linenr}`);
|
||||
renderKconfigPropLiteral(props, 'Menu path', entry.menupath);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue