Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/autotest/logger_metadata/emit_html.py
Views: 1799
from __future__ import print_function12import emitter34class HTMLEmitter(emitter.Emitter):5def preface(self):6return """<!-- Dynamically generated list of Logger Messages7This page was generated using Tools/autotest/logger_metdata/parse.py89DO NOT EDIT10-->111213<h3 style="text-align: center">Onboard Message Log Messages</h3>14<hr />1516<p>This is a list of log messages which may be present in logs produced and stored onboard ArduPilot vehicles.</p>1718<!-- add auto-generated table of contents with "Table of Contents Plus" plugin -->19[toc exclude="Onboard Message Log Messages"]2021"""22def postface(self):23return ""2425def start(self):26self.fh = open("LogMessages.html", mode='w')27print(self.preface(), file=self.fh)2829def emit(self, doccos, enumerations):30self.start()31for docco in doccos:32print(' <h1>%s</h1>' % docco.name, file=self.fh)33if docco.url is not None:34print(' <a href="%s">More information</a>' % docco.url, file=self.fh)35if docco.description is not None:36print(' <h2>%s</h2>' %37docco.description, file=self.fh)38print(' <table>', file=self.fh)39print(" <tr><th>FieldName</th><th>Units/Type</th><th>Description</th><tr>",40file=self.fh)41for f in docco.fields_order:42if "description" in docco.fields[f]:43fdesc = docco.fields[f]["description"]44else:45fdesc = ""46if "units" in docco.fields[f] and docco.fields[f]["units"]!="":47ftypeunits = docco.fields[f]["units"]48elif "fmt" in docco.fields[f] and "char" in docco.fields[f]["fmt"]:49ftypeunits = docco.fields[f]["fmt"]50elif "bitmaskenum" in docco.fields[f]:51ftypeunits = "bitmask"52elif "valueenum" in docco.fields[f]:53ftypeunits = "enum"54else:55ftypeunits = ""56print(' <tr><td>%s</td><td>%s</td><td>%s</td></tr>' % (f, ftypeunits, fdesc),57file=self.fh)58print(' </table>', file=self.fh)5960print("", file=self.fh)61self.stop()6263def stop(self):64print(self.postface(), file=self.fh)65self.fh.close()666768