#!/usr/bin/env python """ Emit docs in a form acceptable to the old Ardupilot wordpress docs site """ from param import known_param_fields, known_units from emit import Emit try: from cgi import escape as cescape except Exception: from html import escape as cescape class HtmlEmit(Emit): def __init__(self, *args, **kwargs): Emit.__init__(self, *args, **kwargs) html_fname = 'Parameters.html' self.f = open(html_fname, mode='w') self.preamble = """

Complete Parameter List


This is a complete list of the parameters which can be set via the MAVLink protocol in the EEPROM of your autopilot to control vehicle behaviour. This list is automatically generated from the latest ardupilot source code, and so may contain parameters which are not yet in the stable released versions of the code.

[toc exclude="Complete Parameter List"] """ self.t = '' def escape(self, s): s = s.replace(' ', '-') s = s.replace(':', '-') s = s.replace('(', '') s = s.replace(')', '') return s def close(self): self.f.write(self.preamble) self.f.write(self.t) self.f.close() def start_libraries(self): pass def emit(self, g): tag = '%s Parameters' % g.reference t = '\n\n

%s

\n' % tag for param in g.params: if not hasattr(param, 'DisplayName') or not hasattr(param, 'Description'): continue d = param.__dict__ tag = '%s (%s)' % (param.DisplayName, param.name) t += '\n\n

%s

' % tag if d.get('User', None) == 'Advanced': t += 'Note: This parameter is for advanced users
' t += "\n\n

%s

\n" % cescape(param.Description) t += "\n" self.t += t