1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Support <hr/> in module docs (#37030)

This commit is contained in:
John R Barker 2018-03-05 19:18:24 +00:00 committed by GitHub
parent 905b3e2f65
commit 0a2dda2060
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,6 +77,7 @@ _MODULE = re.compile(r"M\(([^)]+)\)")
_URL = re.compile(r"U\(([^)]+)\)") _URL = re.compile(r"U\(([^)]+)\)")
_LINK = re.compile(r"L\(([^)]+),([^)]+)\)") _LINK = re.compile(r"L\(([^)]+),([^)]+)\)")
_CONST = re.compile(r"C\(([^)]+)\)") _CONST = re.compile(r"C\(([^)]+)\)")
_RULER = re.compile(r"HORIZONTALLINE")
DEPRECATED = b" (D)" DEPRECATED = b" (D)"
@ -94,6 +95,7 @@ def rst_ify(text):
t = _LINK.sub(r"`\1 <\2>`_", t) t = _LINK.sub(r"`\1 <\2>`_", t)
t = _URL.sub(r"\1", t) t = _URL.sub(r"\1", t)
t = _CONST.sub(r"`\1`", t) t = _CONST.sub(r"`\1`", t)
t = _RULER.sub(r"------------", t)
except Exception as e: except Exception as e:
raise AnsibleError("Could not process (%s) : %s" % (text, e)) raise AnsibleError("Could not process (%s) : %s" % (text, e))
@ -113,6 +115,7 @@ def html_ify(text):
t = _URL.sub(r"<a href='\1'>\1</a>", t) t = _URL.sub(r"<a href='\1'>\1</a>", t)
t = _LINK.sub(r"<a href='\2'>\1</a>", t) t = _LINK.sub(r"<a href='\2'>\1</a>", t)
t = _CONST.sub(r"<code>\1</code>", t) t = _CONST.sub(r"<code>\1</code>", t)
t = _RULER.sub(r"<hr/>", t)
return t return t