diff --git a/Tools/autotest/param_metadata/ednemit.py b/Tools/autotest/param_metadata/ednemit.py index a7fe1227c5..5d253b7e2a 100644 --- a/Tools/autotest/param_metadata/ednemit.py +++ b/Tools/autotest/param_metadata/ednemit.py @@ -32,7 +32,7 @@ class EDNEmit(Emit): def start_libraries(self): pass - def emit(self, g, f): + def emit(self, g): for param in g.params: output_dict = dict() # lowercase all keywords diff --git a/Tools/autotest/param_metadata/emit.py b/Tools/autotest/param_metadata/emit.py index 55279413dd..3414b0fa97 100644 --- a/Tools/autotest/param_metadata/emit.py +++ b/Tools/autotest/param_metadata/emit.py @@ -18,7 +18,7 @@ class Emit: def start_libraries(self): pass - def emit(self, g, f): + def emit(self, g): pass def set_annotate_with_vehicle(self, value): diff --git a/Tools/autotest/param_metadata/htmlemit.py b/Tools/autotest/param_metadata/htmlemit.py index f492d442e8..f7284d060e 100644 --- a/Tools/autotest/param_metadata/htmlemit.py +++ b/Tools/autotest/param_metadata/htmlemit.py @@ -47,7 +47,7 @@ DO NOT EDIT def start_libraries(self): pass - def emit(self, g, f): + def emit(self, g): tag = '%s Parameters' % g.name t = '\n\n

%s

\n' % tag diff --git a/Tools/autotest/param_metadata/mdemit.py b/Tools/autotest/param_metadata/mdemit.py index d40ee4519a..cb7604501a 100644 --- a/Tools/autotest/param_metadata/mdemit.py +++ b/Tools/autotest/param_metadata/mdemit.py @@ -45,7 +45,7 @@ class MDEmit(Emit): def start_libraries(self): pass - def emit(self, g, f): + def emit(self, g): nparam = False # Flag indicating this is a parameter group with redundant information (ie RCn_, SERVOn_) if g.name == 'ArduSub': diff --git a/Tools/autotest/param_metadata/param_parse.py b/Tools/autotest/param_metadata/param_parse.py index acb2af7226..22b403c908 100755 --- a/Tools/autotest/param_metadata/param_parse.py +++ b/Tools/autotest/param_metadata/param_parse.py @@ -22,6 +22,12 @@ parser.add_option("--no-emit", action='store_false', default=True, help="don't emit parameter documention, just validate") +parser.add_option("--format", + dest='output_format', + action='store', + default='all', + choices=['all', 'html', 'rst', 'wiki', 'xml', 'edn', 'md'], + help="what output format to use") (opts, args) = parser.parse_args() @@ -318,28 +324,38 @@ for library in libraries: def do_emit(emit): emit.set_annotate_with_vehicle(len(vehicles) > 1) for vehicle in vehicles: - emit.emit(vehicle, f) + emit.emit(vehicle) emit.start_libraries() for library in libraries: if library.params: - emit.emit(library, f) + emit.emit(library) emit.close() if opts.emit_params: - do_emit(XmlEmit()) - do_emit(WikiEmit()) - do_emit(HtmlEmit()) - do_emit(RSTEmit()) - do_emit(MDEmit()) - try: - from ednemit import EDNEmit - do_emit(EDNEmit()) - except ImportError: - if opts.verbose: - print("Unable to emit EDN, install edn_format and pytz if edn is desired") + if opts.output_format == 'all' or opts.output_format == 'xml': + do_emit(XmlEmit()) + if opts.output_format == 'all' or opts.output_format == 'wiki': + do_emit(WikiEmit()) + if opts.output_format == 'all' or opts.output_format == 'html': + do_emit(HtmlEmit()) + if opts.output_format == 'all' or opts.output_format == 'rst': + do_emit(RSTEmit()) + if opts.output_format == 'all' or opts.output_format == 'md': + do_emit(MDEmit()) + if opts.output_format == 'all' or opts.output_format == 'edn': + try: + from ednemit import EDNEmit + do_emit(EDNEmit()) + except ImportError: + # if the user wanted edn only then don't hide any errors + if opts.output_format == 'edn': + raise + + if opts.verbose: + print("Unable to emit EDN, install edn_format and pytz if edn is desired") sys.exit(error_count) diff --git a/Tools/autotest/param_metadata/rstemit.py b/Tools/autotest/param_metadata/rstemit.py index 050fa5ba7f..e54f1cf2f9 100644 --- a/Tools/autotest/param_metadata/rstemit.py +++ b/Tools/autotest/param_metadata/rstemit.py @@ -179,7 +179,7 @@ Complete Parameter List rows.append(v) return self.tablify(rows, headings=render_info["headings"]) - def emit(self, g, f): + def emit(self, g): tag = '%s Parameters' % self.escape(g.name) reference = "parameters_" + g.name diff --git a/Tools/autotest/param_metadata/wikiemit.py b/Tools/autotest/param_metadata/wikiemit.py index 4134b70c04..7c635751bb 100644 --- a/Tools/autotest/param_metadata/wikiemit.py +++ b/Tools/autotest/param_metadata/wikiemit.py @@ -40,7 +40,7 @@ class WikiEmit(Emit): def start_libraries(self): self.emit_comment("Libraries") - def emit(self, g, f): + def emit(self, g): t = "\n\n== %s Parameters ==\n" % (self.camelcase_escape(g.name)) for param in g.params: diff --git a/Tools/autotest/param_metadata/xmlemit.py b/Tools/autotest/param_metadata/xmlemit.py index 0ca747b34e..f2fa294ca1 100644 --- a/Tools/autotest/param_metadata/xmlemit.py +++ b/Tools/autotest/param_metadata/xmlemit.py @@ -31,7 +31,7 @@ class XmlEmit(Emit): self.f.write('') self.f.write('') - def emit(self, g, f): + def emit(self, g): t = '''\n''' % quoteattr(g.name) # i.e. ArduPlane for param in g.params: