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

regex for finding :ref: labels was flawed

The regex to find labels inside of angle brackets was not detecting
anything before so I missed all of those.
* Fixed the regex in find-plugin-refs to take care of that.
* Fixed plugin_formatter to emit namespaced labels for the M() macro.
This commit is contained in:
Toshio Kuratomi 2018-04-18 07:28:31 -07:00
parent a833281e22
commit f9d83944ec
2 changed files with 2 additions and 2 deletions

View file

@ -38,7 +38,7 @@ def plugin_names(topdir):
def process_refs(topdir, plugin_names): def process_refs(topdir, plugin_names):
REF_RE = re.compile(':ref:`([^`]*)`') REF_RE = re.compile(':ref:`([^`]*)`')
LABEL_RE = re.compile('<[^>]*>`$') LABEL_RE = re.compile('<([^>]*)>$')
# Walk the whole docs tree looking for :ref:. Anywhere those are found, search for `([^`]*)` # Walk the whole docs tree looking for :ref:. Anywhere those are found, search for `([^`]*)`
for dirpath, dirnames, filenames in os.walk(topdir): for dirpath, dirnames, filenames in os.walk(topdir):

View file

@ -91,7 +91,7 @@ def rst_ify(text):
try: try:
t = _ITALIC.sub(r"*\1*", text) t = _ITALIC.sub(r"*\1*", text)
t = _BOLD.sub(r"**\1**", t) t = _BOLD.sub(r"**\1**", t)
t = _MODULE.sub(r":ref:`\1 <\1>`", t) t = _MODULE.sub(r":ref:`\1 <\1_module>`", t)
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)