@@ -86,7 +86,13 @@ def render_list(l, markdown_help, settings=None):
8686 return all_children
8787
8888
89- def print_action_groups (data , nested_content , markdown_help = False , settings = None ):
89+ def print_action_groups (
90+ data ,
91+ nested_content ,
92+ markdown_help = False ,
93+ settings = None ,
94+ id_prefix = '' ,
95+ ):
9096 """
9197 Process all 'action groups', which are also include 'Options' and 'Required
9298 arguments'. A list of nodes is returned.
@@ -97,7 +103,8 @@ def print_action_groups(data, nested_content, markdown_help=False, settings=None
97103 for action_group in data ['action_groups' ]:
98104 # Every action group is composed of a section, holding
99105 # a title, the description, and the option group (members)
100- section = nodes .section (ids = [action_group ['title' ].replace (' ' , '-' ).lower ()])
106+ title_as_id = action_group ['title' ].replace (' ' , '-' ).lower ()
107+ section = nodes .section (ids = [f'{ id_prefix } -{ title_as_id } ' ])
101108 section += nodes .title (action_group ['title' ], action_group ['title' ])
102109
103110 desc = []
@@ -487,6 +494,7 @@ def run(self):
487494 f = self ._open_filename ()
488495 code = compile (f .read (), self .options ['filename' ], 'exec' )
489496 exec (code , mod )
497+ module_name = None
490498 attr_name = self .options ['func' ]
491499 func = mod [attr_name ]
492500 else :
@@ -563,6 +571,7 @@ def run(self):
563571 nested_content ,
564572 markdown_help ,
565573 settings = self .state .document .settings ,
574+ id_prefix = (f'{ module_name } -' if module_name else '' ) + attr_name ,
566575 )
567576 )
568577 if 'nosubcommands' not in self .options :
0 commit comments