summaryrefslogtreecommitdiff
path: root/bin/ansible-doc
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ansible-doc')
-rwxr-xr-xbin/ansible-doc23
1 files changed, 14 insertions, 9 deletions
diff --git a/bin/ansible-doc b/bin/ansible-doc
index 98ff8705..0c50d81e 100755
--- a/bin/ansible-doc
+++ b/bin/ansible-doc
@@ -408,10 +408,10 @@ class DocCLI(CLI, RoleMixin):
t = cls._RULER.sub("\n{0}\n".format("-" * 13), t) # HORIZONTALLINE => -------
# remove rst
- t = cls._RST_SEEALSO.sub(r"See website for:", t) # seealso is special and need to break
- t = cls._RST_NOTE.sub(r"Note:", t) # .. note:: to note:
- t = cls._RST_ROLES.sub(r"website for `", t) # remove :ref: and other tags
- t = cls._RST_DIRECTIVES.sub(r"", t) # remove .. stuff:: in general
+ t = cls._RST_SEEALSO.sub(r"See also:", t) # seealso to See also:
+ t = cls._RST_NOTE.sub(r"Note:", t) # .. note:: to note:
+ t = cls._RST_ROLES.sub(r"`", t) # remove :ref: and other tags, keep tilde to match ending one
+ t = cls._RST_DIRECTIVES.sub(r"", t) # remove .. stuff:: in general
return t
@@ -937,7 +937,7 @@ class DocCLI(CLI, RoleMixin):
return text
@staticmethod
- def find_plugins(path, internal, ptype, collection=None):
+ def find_plugins(path, internal, ptype, collection=None, depth=0):
# if internal, collection could be set to `ansible.builtin`
display.vvvv("Searching %s for plugins" % path)
@@ -960,6 +960,8 @@ class DocCLI(CLI, RoleMixin):
if plugin.startswith('.'):
continue
elif os.path.isdir(full_path):
+ if ptype == 'module' and not plugin.startswith('__') and collection is not None and not internal:
+ plugin_list.update(DocCLI.find_plugins(full_path, False, ptype, collection=collection, depth=depth + 1))
continue
elif any(plugin.endswith(x) for x in C.REJECT_EXTS):
continue
@@ -967,9 +969,8 @@ class DocCLI(CLI, RoleMixin):
continue
elif plugin in C.IGNORE_FILES:
continue
- elif plugin .startswith('_'):
- if os.path.islink(full_path): # avoids aliases
- continue
+ elif os.path.islink(full_path): # avoids aliases
+ continue
plugin = os.path.splitext(plugin)[0] # removes the extension
plugin = plugin.lstrip('_') # remove underscore from deprecated plugins
@@ -977,7 +978,11 @@ class DocCLI(CLI, RoleMixin):
if plugin not in REJECTLIST.get(bkey, ()):
if collection:
- plugin = '%s.%s' % (collection, plugin)
+ composite = [collection]
+ if depth:
+ composite.extend(path.split(os.path.sep)[depth * -1:])
+ composite.append(plugin)
+ plugin = '.'.join(composite)
plugin_list.add(plugin)
display.vvvv("Added %s" % plugin)