aboutsummaryrefslogtreecommitdiff
path: root/describe.py
diff options
context:
space:
mode:
authorBilly SU <g4691821@gmail.com>2020-04-22 03:46:31 +0800
committerGitHub <noreply@github.com>2020-04-21 12:46:31 -0700
commit45cace8887c0de56a7a7eeddee38514ac4fe4cfe (patch)
tree3f28be4fb20585406cef7d60419c4cf90c30a60b /describe.py
parentfb6fcc8fd3d0c2935833537bfff536f736dbfcc3 (diff)
downloadgoogle-api-python-client-45cace8887c0de56a7a7eeddee38514ac4fe4cfe.tar.gz
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
Diffstat (limited to 'describe.py')
-rwxr-xr-xdescribe.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/describe.py b/describe.py
index 1887dc2cb..c808a3ba4 100755
--- a/describe.py
+++ b/describe.py
@@ -247,6 +247,12 @@ def method(name, doc):
"""
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
)