Support role extension for semantic markup. (#80305)

pull/80377/head
Felix Fontein 2 years ago committed by GitHub
parent a81b787a05
commit 0e509ecf25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- "ansible-doc - support role extension for semantic markup spec so that ``O()`` and ``RV()`` referring to role entrypoints are rendered more readable (https://github.com/ansible/ansible/pull/80305)."

@ -411,10 +411,17 @@ class DocCLI(CLI, RoleMixin):
plugin_fqcn = plugin_type = ''
else:
plugin_fqcn = plugin_type = ''
entrypoint = None
if ':' in text:
entrypoint, text = text.split(':', 1)
if value is not None:
text = f"{text}={value}"
if plugin_fqcn and plugin_type:
return f"`{text}' (of {plugin_type} {plugin_fqcn})"
plugin_suffix = '' if plugin_type in ('role', 'module', 'playbook') else ' plugin'
plugin = f"{plugin_type}{plugin_suffix} {plugin_fqcn}"
if plugin_type == 'role' and entrypoint is not None:
plugin = f"{plugin}, {entrypoint} entrypoint"
return f"`{text}' (of {plugin})"
return f"`{text}'"
@classmethod

@ -9,6 +9,7 @@ module: randommodule
short_description: A random module
description:
- A random module.
- See O(foo.bar.baz#role:main:foo=bar) for how this is used in the P(foo.bar.baz#role)'s C(main) entrypoint.
author:
- Ansible Core Team
version_added: 1.0.0

@ -1,6 +1,8 @@
> TESTNS.TESTCOL.RANDOMMODULE (./collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py)
A random module.
A random module. See `foo=bar' (of role foo.bar.baz, main
entrypoint) for how this is used in the [foo.bar.baz]'s `main'
entrypoint.
ADDED IN: version 1.0.0 of testns.testcol
@ -104,7 +106,7 @@ RETURN VALUES:
This should be in the middle.
Has some more data.
Check out `m_middle.suboption' and compare it to `a_first=foo'
and `value' (of lookup community.general.foo).
and `value' (of lookup plugin community.general.foo).
returned: success and 1st of month
type: dict

@ -12,7 +12,8 @@
"why": "Test deprecation"
},
"description": [
"A random module."
"A random module.",
"See O(foo.bar.baz#role:main:foo=bar) for how this is used in the P(foo.bar.baz#role)'s C(main) entrypoint."
],
"filename": "./collections/ansible_collections/testns/testcol/plugins/modules/randommodule.py",
"has_action": false,

Loading…
Cancel
Save