Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/ednemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def start_libraries(self):

def emit(self, g):
for param in g.params:
if not self.should_emit_param(param):
continue
output_dict = dict()
# lowercase all keywords
for key in param.__dict__.keys():
Expand Down
6 changes: 6 additions & 0 deletions Tools/autotest/param_metadata/emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def __init__(self):
pass

prog_values_field = re.compile(r"-?\d*\.?\d+: ?[\w ]+,?")
emit_legacy_params = True

def close(self):
pass
Expand All @@ -20,5 +21,10 @@ def start_libraries(self):
def emit(self, g):
pass

def should_emit_param(self, param):
if not self.emit_legacy_params and getattr(param, 'Legacy', False):
return False
return True

def should_emit_field(self, param, field):
return field not in ['Legacy']
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/htmlemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def emit(self, g):
t = '\n\n<h1>%s</h1>\n' % tag

for param in g.params:
if not self.should_emit_param(param):
continue
if not hasattr(param, 'DisplayName') or not hasattr(param, 'Description'):
continue
d = param.__dict__
Expand Down
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/jsonemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def emit(self, g):

# Check all params available
for param in g.params:
if not self.should_emit_param(param):
continue
param_json = {}

# Get display name
Expand Down
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/mdemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def emit(self, g):
t = '\n\n# %s' % tag

for param in g.params:
if not self.should_emit_param(param):
continue
if not hasattr(param, 'DisplayName') or not hasattr(param, 'Description'):
continue
d = param.__dict__
Expand Down
18 changes: 18 additions & 0 deletions Tools/autotest/param_metadata/param_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
action='store_false',
default=True,
help="don't emit parameter documentation, just validate")
parser.add_argument("--legacy-params",
dest='emit_legacy_params',
action='store_true',
default=None,
help="include legacy parameters in output (default depends on format)")
parser.add_argument("--no-legacy-params",
dest='emit_legacy_params',
action='store_false',
default=None,
help="don't include legacy parameters in output (default depends on format)")
parser.add_argument("--format",
dest='output_format',
action='store',
Expand Down Expand Up @@ -713,6 +723,14 @@ def validate(param, is_library=False):
for emitter_name in emitters_to_use:
emit = all_emitters[emitter_name]()

emit.emit_legacy_params = args.emit_legacy_params
if emit.emit_legacy_params is None:
if emitter_name in ('rst', 'rstlatexpdf'):
# do not emit legacy parameters to the Wiki
emit.emit_legacy_params = False
else:
emit.emit_legacy_params = True

emit.emit(vehicle)

emit.start_libraries()
Expand Down
3 changes: 1 addition & 2 deletions Tools/autotest/param_metadata/rstemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ def emit(self, g):
reference=reference)

for param in g.params:
if getattr(param, "Legacy", False):
# do not emit legacy parameters to the Wiki
if not self.should_emit_param(param):
continue
if not hasattr(param, 'DisplayName') or not hasattr(param, 'Description'):
continue
Expand Down
2 changes: 2 additions & 0 deletions Tools/autotest/param_metadata/xmlemit.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def emit(self, g):
xml_parameters = etree.SubElement(self.current_element, 'parameters', name=g.reference) # i.e. ArduPlane

for param in g.params:
if not self.should_emit_param(param):
continue
# Begin our parameter node
if hasattr(param, 'DisplayName'):
xml_param = etree.SubElement(xml_parameters, 'param', humanName=param.DisplayName, name=param.name) # i.e. ArduPlane (ArduPlane:FOOPARM)
Expand Down
Loading