autotest: fixed compatibility with python on wiki server
This commit is contained in:
parent
f0954f35a7
commit
529bc6b77c
@ -5,7 +5,10 @@ Emit docs in a form acceptable to the old Ardupilot wordpress docs site
|
|||||||
|
|
||||||
from param import known_param_fields, known_units
|
from param import known_param_fields, known_units
|
||||||
from emit import Emit
|
from emit import Emit
|
||||||
import html
|
try:
|
||||||
|
from cgi import escape as cescape
|
||||||
|
except Exception:
|
||||||
|
from html import escape as cescape
|
||||||
|
|
||||||
|
|
||||||
class HtmlEmit(Emit):
|
class HtmlEmit(Emit):
|
||||||
@ -59,7 +62,7 @@ DO NOT EDIT
|
|||||||
t += '\n\n<h2>%s</h2>' % tag
|
t += '\n\n<h2>%s</h2>' % tag
|
||||||
if d.get('User', None) == 'Advanced':
|
if d.get('User', None) == 'Advanced':
|
||||||
t += '<em>Note: This parameter is for advanced users</em><br>'
|
t += '<em>Note: This parameter is for advanced users</em><br>'
|
||||||
t += "\n\n<p>%s</p>\n" % html.escape(param.Description)
|
t += "\n\n<p>%s</p>\n" % cescape(param.Description)
|
||||||
t += "<ul>\n"
|
t += "<ul>\n"
|
||||||
|
|
||||||
for field in param.__dict__.keys():
|
for field in param.__dict__.keys():
|
||||||
@ -77,8 +80,8 @@ DO NOT EDIT
|
|||||||
abreviated_units = param.__dict__[field]
|
abreviated_units = param.__dict__[field]
|
||||||
if abreviated_units != '':
|
if abreviated_units != '':
|
||||||
units = known_units[abreviated_units] # use the known_units dictionary to convert the abreviated unit into a full textual one
|
units = known_units[abreviated_units] # use the known_units dictionary to convert the abreviated unit into a full textual one
|
||||||
t += "<li>%s: %s</li>\n" % (field, html.escape(units))
|
t += "<li>%s: %s</li>\n" % (field, cescape(units))
|
||||||
else:
|
else:
|
||||||
t += "<li>%s: %s</li>\n" % (field, html.escape(param.__dict__[field]))
|
t += "<li>%s: %s</li>\n" % (field, cescape(param.__dict__[field]))
|
||||||
t += "</ul>\n"
|
t += "</ul>\n"
|
||||||
self.t += t
|
self.t += t
|
||||||
|
@ -3,7 +3,10 @@ from __future__ import print_function
|
|||||||
import re
|
import re
|
||||||
from param import known_param_fields, known_units
|
from param import known_param_fields, known_units
|
||||||
from emit import Emit
|
from emit import Emit
|
||||||
import html
|
try:
|
||||||
|
from cgi import escape as cescape
|
||||||
|
except Exception:
|
||||||
|
from html import escape as cescape
|
||||||
|
|
||||||
|
|
||||||
# Emit docs in a RST format
|
# Emit docs in a RST format
|
||||||
@ -256,9 +259,9 @@ Complete Parameter List
|
|||||||
# convert the abreviated unit into a full
|
# convert the abreviated unit into a full
|
||||||
# textual one:
|
# textual one:
|
||||||
units = known_units[abreviated_units]
|
units = known_units[abreviated_units]
|
||||||
row.append(html.escape(units))
|
row.append(cescape(units))
|
||||||
else:
|
else:
|
||||||
row.append(html.escape(param.__dict__[field]))
|
row.append(cescape(param.__dict__[field]))
|
||||||
if len(row):
|
if len(row):
|
||||||
ret += "\n\n" + self.tablify([row], headings=headings) + "\n\n"
|
ret += "\n\n" + self.tablify([row], headings=headings) + "\n\n"
|
||||||
self.t += ret + "\n"
|
self.t += ret + "\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user