param_parse.py: emit rst heading only for SIM_, no children

This commit is contained in:
Peter Barker 2023-01-09 14:29:38 +11:00 committed by Peter Barker
parent 8de890bc7d
commit bd850b9034
1 changed files with 15 additions and 3 deletions

View File

@ -28,6 +28,7 @@ This list is automatically generated from the latest ardupilot source code, and
self.f = open(self.output_fname(), mode='w')
self.spacer = re.compile("^", re.MULTILINE)
self.rstescape = re.compile("([^a-zA-Z0-9\n ])")
self.emitted_sitl_heading = False
parameterlisttype = "Complete Parameter List"
parameterlisttype += "\n" + "=" * len(parameterlisttype)
self.preamble = """.. Dynamically generated list of documented parameters
@ -191,6 +192,15 @@ This list is automatically generated from the latest ardupilot source code, and
return ''
def emit(self, g):
# make only a single group for SIM_ parameters
do_emit_heading = True
if g.reference.startswith("SIM_"):
if self.emitted_sitl_heading:
do_emit_heading = False
self.emitted_sitl_heading = True
tag = "Simulation Parameters"
reference = "parameters_sim"
else:
tag = '%s Parameters' % self.escape(g.reference)
reference = "parameters_" + g.reference
@ -203,6 +213,8 @@ This list is automatically generated from the latest ardupilot source code, and
},
}
ret = ""
if do_emit_heading:
ret = """
.. _{reference}: