docs: Workaround for non-string values (#36720)

* Workaround for non-string values

So I think the proper fix should go into html_ify, which should convert
any value into a string, rather than expecting strings only.

* My preferred solution
This commit is contained in:
Dag Wieers 2018-02-27 19:28:47 +01:00 committed by John R Barker
parent e75989ec88
commit 50e989f906

View file

@ -48,7 +48,7 @@ from jinja2 import Environment, FileSystemLoader
from six import iteritems, string_types
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_bytes
from ansible.module_utils._text import to_bytes, to_text
from ansible.plugins.loader import fragment_loader
from ansible.utils import plugin_docs
from ansible.utils.display import Display
@ -101,6 +101,9 @@ def rst_ify(text):
def html_ify(text):
''' convert symbols like I(this is in italics) to valid HTML '''
if not isinstance(text, string_types):
text = to_text(text)
t = html_escape(text)
t = _ITALIC.sub(r"<em>\1</em>", t)
t = _BOLD.sub(r"<b>\1</b>", t)