From 50e989f90608b7c70dedbbd27c7c127b3d0d3a6b Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Tue, 27 Feb 2018 19:28:47 +0100 Subject: [PATCH] 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 --- docs/bin/plugin_formatter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py index d1e6e659e28..6223a202621 100755 --- a/docs/bin/plugin_formatter.py +++ b/docs/bin/plugin_formatter.py @@ -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"\1", t) t = _BOLD.sub(r"\1", t)