diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py index 4d630bfdfa..216a537fc5 100755 --- a/docs/bin/plugin_formatter.py +++ b/docs/bin/plugin_formatter.py @@ -87,13 +87,13 @@ def rst_ify(text): ''' convert symbols like I(this is in italics) to valid restructured text ''' try: - t = _ITALIC.sub(r'*' + r"\1" + r"*", text) - t = _BOLD.sub(r'**' + r"\1" + r"**", t) - t = _MODULE.sub(r':ref:`module_docs/' + r"\1 <\1>" + r"`", t) + t = _ITALIC.sub(r"*\1*", text) + t = _BOLD.sub(r"**\1**", t) + t = _MODULE.sub(r":ref:`\1`", t) t = _URL.sub(r"\1", t) - t = _CONST.sub(r'``' + r"\1" + r"``", t) + t = _CONST.sub(r"`\1`", t) except Exception as e: - raise AnsibleError("Could not process (%s) : %s" % (str(text), str(e))) + raise AnsibleError("Could not process (%s) : %s" % (text, e)) return t @@ -102,11 +102,11 @@ def html_ify(text): ''' convert symbols like I(this is in italics) to valid HTML ''' t = html_escape(text) - t = _ITALIC.sub("" + r"\1" + "", t) - t = _BOLD.sub("" + r"\1" + "", t) - t = _MODULE.sub("" + r"\1" + "", t) - t = _URL.sub("" + r"\1" + "", t) - t = _CONST.sub("" + r"\1" + "", t) + t = _ITALIC.sub(r"\1", t) + t = _BOLD.sub(r"\1", t) + t = _MODULE.sub(r"\1", t) + t = _URL.sub(r"\1", t) + t = _CONST.sub(r"\1", t) return t