docs: fix unescaped html tag (#802)
If the description of the method contains any HTML tag, it will
break the HTML rendering.
This commit escapes the html tag to prevent this problem.
* Use html standard lib when using python3
* Use cgi standard lib when using python2
Refs #791
Release-As: 1.8.2
diff --git a/describe.py b/describe.py
index 1887dc2..c808a3b 100755
--- a/describe.py
+++ b/describe.py
@@ -247,6 +247,12 @@
"""
params = method_params(doc)
+ if sys.version_info.major >= 3:
+ import html
+ doc = html.escape(doc)
+ else:
+ import cgi
+ doc = cgi.escape(doc)
return string.Template(METHOD_TEMPLATE).substitute(
name=name, params=params, doc=doc
)