tools: Sort menu content in Kconfig option reference

This commit is contained in:
Roland Dobai
2020-10-21 12:25:57 +02:00
committed by bot
parent 6c58c1f73d
commit aaa46a93da

View File

@@ -271,19 +271,18 @@ def write_menu_item(f, node, visibility):
if is_menu: if is_menu:
# enumerate links to child items # enumerate links to child items
first = True child_list = []
child = node.list child = node.list
while child: while child:
try: if not is_choice(child) and child.prompt and visibility.visible(child):
if not is_choice(child) and child.prompt and visibility.visible(child): child_list.append((child.prompt[0], get_link_anchor(child)))
if first:
f.write("Contains:\n\n")
first = False
f.write('- :ref:`%s`\n' % get_link_anchor(child))
except AttributeError:
pass
child = child.next child = child.next
f.write('\n') if len(child_list) > 0:
f.write("Contains:\n\n")
sorted_child_list = sorted(child_list, key=lambda pair: pair[0].lower())
ref_list = ['- :ref:`{}`'.format(anchor) for _, anchor in sorted_child_list]
f.write('\n'.join(ref_list))
f.write('\n\n')
if __name__ == '__main__': if __name__ == '__main__':