px4-firmware/Tools/px4params/dokuwikiout.py

38 lines
1.5 KiB
Python
Raw Normal View History

2013-10-17 20:47:15 -03:00
import output
class DokuWikiOutput(output.Output):
def Generate(self, groups):
result = ""
for group in groups:
result += "==== %s ====\n\n" % group.GetName()
2014-01-13 03:33:25 -04:00
result += "^ Name ^ Description ^ Min ^ Max ^ Default ^ Comment ^\n"
2013-10-17 20:47:15 -03:00
for param in group.GetParams():
code = param.GetFieldValue("code")
name = param.GetFieldValue("short_desc")
2014-01-13 03:33:25 -04:00
name = name.replace("\n", "")
result += "| %s | %s " % (code, name)
2013-10-17 20:47:15 -03:00
min_val = param.GetFieldValue("min")
if min_val is not None:
2014-01-13 03:33:25 -04:00
result += "| %s " % min_val
else:
result += "|"
2013-10-17 20:47:15 -03:00
max_val = param.GetFieldValue("max")
if max_val is not None:
2014-01-13 03:33:25 -04:00
result += "| %s " % max_val
else:
result += "|"
2013-10-17 20:47:15 -03:00
def_val = param.GetFieldValue("default")
if def_val is not None:
2014-01-13 03:33:25 -04:00
result += "| %s " % def_val
else:
result += "|"
long_desc = param.GetFieldValue("long_desc")
if long_desc is not None:
long_desc = long_desc.replace("\n", "")
result += "| %s " % long_desc
else:
result += "|"
result += "|\n"
result += "\n"
2013-10-17 20:47:15 -03:00
return result