Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 45cace8

Browse files
authored
docs: fix unescaped html tag (googleapis#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 googleapis#791 Release-As: 1.8.2
1 parent fb6fcc8 commit 45cace8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

describe.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,12 @@ def method(name, doc):
247247
"""
248248

249249
params = method_params(doc)
250+
if sys.version_info.major >= 3:
251+
import html
252+
doc = html.escape(doc)
253+
else:
254+
import cgi
255+
doc = cgi.escape(doc)
250256
return string.Template(METHOD_TEMPLATE).substitute(
251257
name=name, params=params, doc=doc
252258
)

0 commit comments

Comments
 (0)