summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFelix Fontein <felix@fontein.de>2023-03-28 20:06:58 +0200
committerGitHub <noreply@github.com>2023-03-28 11:06:58 -0700
commite9603d233c739f2cc86ac5453251f4fcf9a2ad34 (patch)
tree9cce37d6c640e618f12d15c2d55a98f4d2475b95 /lib
parentc6e717cdf0b1854d50d49c06194f9339d80f9e32 (diff)
downloadansible-e9603d233c739f2cc86ac5453251f4fcf9a2ad34.tar.gz
[2.13] ansible-doc: fix broken seealso links in text output (#80286)
* ansible-doc: fix broken seealso links in text output (#80280) * Fix broken URLs. * Also remove auto-generated description for modules outside ansible.builtin. (cherry picked from commit fafb23094e77a619066a92a7fa99a7045292e473) * Fix URL processing. (#80295) (cherry picked from commit 086ae4220957cdb66eee8aa060c151a071f3b9bd)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/ansible/cli/doc.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py
index 0c50d81eec..2ef300bc4b 100755
--- a/lib/ansible/cli/doc.py
+++ b/lib/ansible/cli/doc.py
@@ -1298,10 +1298,16 @@ class DocCLI(CLI, RoleMixin):
if 'module' in item:
text.append(textwrap.fill(DocCLI.tty_ify('Module %s' % item['module']),
limit - 6, initial_indent=opt_indent[:-2] + "* ", subsequent_indent=opt_indent))
- description = item.get('description', 'The official documentation on the %s module.' % item['module'])
- text.append(textwrap.fill(DocCLI.tty_ify(description), limit - 6, initial_indent=opt_indent + ' ', subsequent_indent=opt_indent + ' '))
- text.append(textwrap.fill(DocCLI.tty_ify(get_versioned_doclink('modules/%s_module.html' % item['module'])),
- limit - 6, initial_indent=opt_indent + ' ', subsequent_indent=opt_indent))
+ description = item.get('description')
+ if description is None and item['module'].startswith('ansible.builtin.'):
+ description = 'The official documentation on the %s module.' % item['module']
+ if description is not None:
+ text.append(textwrap.fill(DocCLI.tty_ify(description),
+ limit - 6, initial_indent=opt_indent + ' ', subsequent_indent=opt_indent + ' '))
+ if item['module'].startswith('ansible.builtin.'):
+ relative_url = 'collections/%s_module.html' % item['module'].replace('.', '/', 2)
+ text.append(textwrap.fill(DocCLI.tty_ify(get_versioned_doclink(relative_url)),
+ limit - 6, initial_indent=opt_indent + ' ', subsequent_indent=opt_indent))
elif 'name' in item and 'link' in item and 'description' in item:
text.append(textwrap.fill(DocCLI.tty_ify(item['name']),
limit - 6, initial_indent=opt_indent[:-2] + "* ", subsequent_indent=opt_indent))