diff --git a/changelogs/fragments/9-semantic-markup-roles.yml b/changelogs/fragments/9-semantic-markup-roles.yml new file mode 100644 index 0000000..66ef66a --- /dev/null +++ b/changelogs/fragments/9-semantic-markup-roles.yml @@ -0,0 +1,5 @@ +minor_changes: + - "Add support for semantic markup in roles (https://github.com/ansible-community/antsibull-docs-parser/pull/9)." +breaking_changes: + - "Modify ``LinkProvider.plugin_option_like_link`` signature to include a new argument ``entrypoint`` after ``plugin`` (https://github.com/ansible-community/antsibull-docs-parser/pull/9)." + - "Extend ``OptionNamePart`` and ``ReturnValuePart`` named tuples by adding ``entrypoint`` after ``plugin`` (https://github.com/ansible-community/antsibull-docs-parser/pull/9)." diff --git a/src/antsibull_docs_parser/dom.py b/src/antsibull_docs_parser/dom.py index 2fb4b47..bbfebce 100644 --- a/src/antsibull_docs_parser/dom.py +++ b/src/antsibull_docs_parser/dom.py @@ -94,6 +94,7 @@ class CodePart(NamedTuple): class OptionNamePart(NamedTuple): plugin: t.Optional[PluginIdentifier] + entrypoint: t.Optional[str] # present iff plugin.type == 'role' link: t.List[str] name: str value: t.Optional[str] @@ -112,6 +113,7 @@ class EnvVariablePart(NamedTuple): class ReturnValuePart(NamedTuple): plugin: t.Optional[PluginIdentifier] + entrypoint: t.Optional[str] # present iff plugin.type == 'role' link: t.List[str] name: str value: t.Optional[str] diff --git a/src/antsibull_docs_parser/format.py b/src/antsibull_docs_parser/format.py index 87f36a9..4ad3b57 100644 --- a/src/antsibull_docs_parser/format.py +++ b/src/antsibull_docs_parser/format.py @@ -28,6 +28,7 @@ def plugin_link( # pylint:disable=no-self-use def plugin_option_like_link( # pylint:disable=no-self-use self, plugin: dom.PluginIdentifier, # pylint:disable=unused-argument + entrypoint: t.Optional[str], # pylint:disable=unused-argument # pylint:disable-next=unused-argument what: "t.Union[t.Literal['option'], t.Literal['retval']]", # pylint:disable-next=unused-argument @@ -174,7 +175,11 @@ def process_option_name(self, part: dom.OptionNamePart) -> None: url = None if part.plugin: url = self.link_provider.plugin_option_like_link( - part.plugin, "option", part.link, part.plugin == self.current_plugin + part.plugin, + part.entrypoint, + "option", + part.link, + part.plugin == self.current_plugin, ) self.destination.append(self.formatter.format_option_name(part, url)) @@ -189,7 +194,11 @@ def process_return_value(self, part: dom.ReturnValuePart) -> None: url = None if part.plugin: url = self.link_provider.plugin_option_like_link( - part.plugin, "retval", part.link, part.plugin == self.current_plugin + part.plugin, + part.entrypoint, + "retval", + part.link, + part.plugin == self.current_plugin, ) self.destination.append(self.formatter.format_return_value(part, url)) diff --git a/src/antsibull_docs_parser/parser.py b/src/antsibull_docs_parser/parser.py index 017617f..f9f4ce0 100644 --- a/src/antsibull_docs_parser/parser.py +++ b/src/antsibull_docs_parser/parser.py @@ -35,6 +35,7 @@ def _is_plugin_type(text: str) -> bool: class Context(t.NamedTuple): current_plugin: t.Optional[dom.PluginIdentifier] = None + role_entrypoint: t.Optional[str] = None class CommandParser(abc.ABC): @@ -146,10 +147,13 @@ def parse(self, parameters: t.List[str], context: Context) -> dom.AnyPart: def _parse_option_like( text: str, context: Context, -) -> t.Tuple[t.Optional[dom.PluginIdentifier], t.List[str], str, t.Optional[str]]: +) -> t.Tuple[ + t.Optional[dom.PluginIdentifier], t.Optional[str], t.List[str], str, t.Optional[str] +]: value = None if "=" in text: text, value = text.split("=", 1) + entrypoint: t.Optional[str] = None m = _FQCN_TYPE_PREFIX_RE.match(text) if m: plugin_fqcn = m.group(1) @@ -165,10 +169,19 @@ def _parse_option_like( text = text[len(_IGNORE_MARKER) :] else: plugin_identifier = context.current_plugin + entrypoint = context.role_entrypoint + if plugin_identifier is not None and plugin_identifier.type == "role": + part1, sep, part2 = text.partition(":") + if sep: + entrypoint = part1 + text = part2 + if entrypoint is None: + raise ValueError("Role reference is missing entrypoint") if ":" in text or "#" in text: raise ValueError(f'Invalid option/return value name "{text}"') return ( plugin_identifier, + entrypoint, _ARRAY_STUB_RE.sub("", text).split("."), text, value, @@ -212,8 +225,12 @@ def __init__(self): super().__init__("O", 1, escaped_arguments=True) def parse(self, parameters: t.List[str], context: Context) -> dom.AnyPart: - plugin, link, name, value = _parse_option_like(parameters[0], context) - return dom.OptionNamePart(plugin=plugin, link=link, name=name, value=value) + plugin, entrypoint, link, name, value = _parse_option_like( + parameters[0], context + ) + return dom.OptionNamePart( + plugin=plugin, entrypoint=entrypoint, link=link, name=name, value=value + ) class _ReturnValue(CommandParserEx): @@ -221,8 +238,12 @@ def __init__(self): super().__init__("RV", 1, escaped_arguments=True) def parse(self, parameters: t.List[str], context: Context) -> dom.AnyPart: - plugin, link, name, value = _parse_option_like(parameters[0], context) - return dom.ReturnValuePart(plugin=plugin, link=link, name=name, value=value) + plugin, entrypoint, link, name, value = _parse_option_like( + parameters[0], context + ) + return dom.ReturnValuePart( + plugin=plugin, entrypoint=entrypoint, link=link, name=name, value=value + ) _COMMANDS = [ diff --git a/src/antsibull_docs_parser/rst.py b/src/antsibull_docs_parser/rst.py index ff1e240..8bdef7c 100644 --- a/src/antsibull_docs_parser/rst.py +++ b/src/antsibull_docs_parser/rst.py @@ -44,6 +44,10 @@ def _format_option_like( result.append("#") result.append(plugin.type) result.append(":") + entrypoint = part.entrypoint + if entrypoint is not None: + result.append(entrypoint) + result.append(":") result.append(part.name) value = part.value if value is not None: diff --git a/test-vectors.yaml b/test-vectors.yaml index 81727c2..40aa2a7 100644 --- a/test-vectors.yaml +++ b/test-vectors.yaml @@ -155,6 +155,12 @@ test_vectors: O(bam.baz.foo#lookup:foo=) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=) - |- O(bam.baz.foo#lookup:foo=bar) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=bar) + - |- + O(bam.baz.foo#role:main:foo) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]) + - |- + O(bam.baz.foo#role:main:foo=) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=) + - |- + O(bam.baz.foo#role:main:foo=bar) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=bar) - |- O(ignore:foo) O(ignore:bar.baz[123].bam[len(x\) - 1]) - |- @@ -162,9 +168,9 @@ test_vectors: - |- O(ignore:foo=bar) O(ignore:bar.baz[123].bam[len(x\) - 1]=bar) html: |- -
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
@@ -183,6 +189,12 @@ test_vectors:
foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
rst: |-
\ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
@@ -196,6 +208,12 @@ test_vectors:
\ :ansopt:`bam.baz.foo#lookup:foo=bar`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=bar`\
+ \ :ansopt:`bam.baz.foo#role:main:foo`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=bar`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
\ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
\ :ansopt:`foo=`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=`\
@@ -215,6 +233,12 @@ test_vectors:
O(bam.baz.foo#lookup:foo=) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=)
- |-
O(bam.baz.foo#lookup:foo=bar) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(bam.baz.foo#role:main:foo) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(bam.baz.foo#role:main:foo=) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(bam.baz.foo#role:main:foo=bar) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=bar)
- |-
O(ignore:foo) O(ignore:bar.baz[123].bam[len(x\) - 1])
- |-
@@ -222,9 +246,9 @@ test_vectors:
- |-
O(ignore:foo=bar) O(ignore:bar.baz[123].bam[len(x\) - 1]=bar)
html: |-
- foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
@@ -243,6 +267,12 @@ test_vectors:
foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
rst: |-
\ :ansopt:`foo.bar.baz.bam#boo:foo`\ \ :ansopt:`foo.bar.baz.bam#boo:bar.baz[123].bam[len(x) - 1]`\
@@ -256,6 +286,12 @@ test_vectors:
\ :ansopt:`bam.baz.foo#lookup:foo=bar`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=bar`\
+ \ :ansopt:`bam.baz.foo#role:main:foo`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=bar`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
\ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
\ :ansopt:`foo=`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=`\
@@ -265,6 +301,107 @@ test_vectors:
current_plugin:
fqcn: foo.bar.baz.bam
type: boo
+ option_name_current_role:
+ source:
+ - |-
+ O(foo) O(bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(foo=) O(bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(foo=bar) O(bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(other_entrypoint:foo) O(other_entrypoint:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(other_entrypoint:foo=) O(other_entrypoint:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(other_entrypoint:foo=bar) O(other_entrypoint:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(bam.baz.foo#lookup:foo) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(bam.baz.foo#lookup:foo=) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(bam.baz.foo#lookup:foo=bar) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(bam.baz.foo#role:main:foo) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(bam.baz.foo#role:main:foo=) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(bam.baz.foo#role:main:foo=bar) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(ignore:foo) O(ignore:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(ignore:foo=) O(ignore:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(ignore:foo=bar) O(ignore:bar.baz[123].bam[len(x\) - 1]=bar)
+ html: |-
+ foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+ rst: |-
+ \ :ansopt:`foo.bar.baz#role:main:foo`\ \ :ansopt:`foo.bar.baz#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`foo.bar.baz#role:main:foo=`\ \ :ansopt:`foo.bar.baz#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`foo.bar.baz#role:main:foo=bar`\ \ :ansopt:`foo.bar.baz#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:foo`\ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:foo=`\ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:foo=bar`\ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`bam.baz.foo#lookup:foo`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#lookup:foo=`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#lookup:foo=bar`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=bar`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`foo=`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`foo=bar`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=bar`\
+ parse_opts:
+ current_plugin:
+ fqcn: foo.bar.baz
+ type: role
+ role_entrypoint: main
option_name_no_current_plugin_w_links:
source:
- |-
@@ -279,6 +416,12 @@ test_vectors:
O(bam.baz.foo#lookup:foo=) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=)
- |-
O(bam.baz.foo#lookup:foo=bar) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(bam.baz.foo#role:main:foo) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(bam.baz.foo#role:main:foo=) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(bam.baz.foo#role:main:foo=bar) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=bar)
- |-
O(ignore:foo) O(ignore:bar.baz[123].bam[len(x\) - 1])
- |-
@@ -286,14 +429,14 @@ test_vectors:
- |-
O(ignore:foo=bar) O(ignore:bar.baz[123].bam[len(x\) - 1]=bar)
html: |-
- foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
@@ -307,6 +450,12 @@ test_vectors:
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
@@ -314,9 +463,9 @@ test_vectors:
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
md_opts:
pluginOptionLikeLink.js: |-
- (plugin, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}-${name.join('/')}`
+ (plugin, entrypoint, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}${entrypoint ? '-' + entrypoint : ''}-${name.join('/')}`
pluginOptionLikeLink.py: |-
- lambda plugin, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}-{'/'.join(name)}"
+ lambda plugin, entrypoint, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}{'-' + entrypoint if entrypoint else ''}-{'/'.join(name)}"
rst: |-
\ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
@@ -330,6 +479,12 @@ test_vectors:
\ :ansopt:`bam.baz.foo#lookup:foo=bar`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=bar`\
+ \ :ansopt:`bam.baz.foo#role:main:foo`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=bar`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
\ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
\ :ansopt:`foo=`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=`\
@@ -349,6 +504,12 @@ test_vectors:
O(bam.baz.foo#lookup:foo=) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=)
- |-
O(bam.baz.foo#lookup:foo=bar) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(bam.baz.foo#role:main:foo) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(bam.baz.foo#role:main:foo=) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(bam.baz.foo#role:main:foo=bar) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=bar)
- |-
O(ignore:foo) O(ignore:bar.baz[123].bam[len(x\) - 1])
- |-
@@ -356,14 +517,14 @@ test_vectors:
- |-
O(ignore:foo=bar) O(ignore:bar.baz[123].bam[len(x\) - 1]=bar)
html: |-
- foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
@@ -377,6 +538,12 @@ test_vectors:
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
@@ -384,9 +551,9 @@ test_vectors:
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
md_opts:
pluginOptionLikeLink.js: |-
- (plugin, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}-${name.join('/')}`
+ (plugin, entrypoint, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}${entrypoint ? '-' + entrypoint : ''}-${name.join('/')}`
pluginOptionLikeLink.py: |-
- lambda plugin, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}-{'/'.join(name)}"
+ lambda plugin, entrypoint, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}{'-' + entrypoint if entrypoint else ''}-{'/'.join(name)}"
rst: |-
\ :ansopt:`foo.bar.baz.bam#boo:foo`\ \ :ansopt:`foo.bar.baz.bam#boo:bar.baz[123].bam[len(x) - 1]`\
@@ -400,6 +567,12 @@ test_vectors:
\ :ansopt:`bam.baz.foo#lookup:foo=bar`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=bar`\
+ \ :ansopt:`bam.baz.foo#role:main:foo`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=bar`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
\ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
\ :ansopt:`foo=`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=`\
@@ -409,6 +582,117 @@ test_vectors:
current_plugin:
fqcn: foo.bar.baz.bam
type: boo
+ option_name_current_role_w_links:
+ source:
+ - |-
+ O(foo) O(bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(foo=) O(bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(foo=bar) O(bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(other_entrypoint:foo) O(other_entrypoint:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(other_entrypoint:foo=) O(other_entrypoint:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(other_entrypoint:foo=bar) O(other_entrypoint:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(bam.baz.foo#lookup:foo) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(bam.baz.foo#lookup:foo=) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(bam.baz.foo#lookup:foo=bar) O(bam.baz.foo#lookup:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(bam.baz.foo#role:main:foo) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(bam.baz.foo#role:main:foo=) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(bam.baz.foo#role:main:foo=bar) O(bam.baz.foo#role:main:bar.baz[123].bam[len(x\) - 1]=bar)
+ - |-
+ O(ignore:foo) O(ignore:bar.baz[123].bam[len(x\) - 1])
+ - |-
+ O(ignore:foo=) O(ignore:bar.baz[123].bam[len(x\) - 1]=)
+ - |-
+ O(ignore:foo=bar) O(ignore:bar.baz[123].bam[len(x\) - 1]=bar)
+ html: |-
+ foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+
+ foo
bar.baz\[123\].bam\[len\(x\) \- 1\]
+
+ foo\=
bar.baz\[123\].bam\[len\(x\) \- 1\]\=
+
+ foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
+ md_opts:
+ pluginOptionLikeLink.js: |-
+ (plugin, entrypoint, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}${entrypoint ? '-' + entrypoint : ''}-${name.join('/')}`
+ pluginOptionLikeLink.py: |-
+ lambda plugin, entrypoint, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}{'-' + entrypoint if entrypoint else ''}-{'/'.join(name)}"
+ rst: |-
+ \ :ansopt:`foo.bar.baz#role:main:foo`\ \ :ansopt:`foo.bar.baz#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`foo.bar.baz#role:main:foo=`\ \ :ansopt:`foo.bar.baz#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`foo.bar.baz#role:main:foo=bar`\ \ :ansopt:`foo.bar.baz#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:foo`\ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:foo=`\ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:foo=bar`\ \ :ansopt:`foo.bar.baz#role:other\_entrypoint:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`bam.baz.foo#lookup:foo`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#lookup:foo=`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#lookup:foo=bar`\ \ :ansopt:`bam.baz.foo#lookup:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`bam.baz.foo#role:main:foo=bar`\ \ :ansopt:`bam.baz.foo#role:main:bar.baz[123].bam[len(x) - 1]=bar`\
+
+ \ :ansopt:`foo`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]`\
+
+ \ :ansopt:`foo=`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=`\
+
+ \ :ansopt:`foo=bar`\ \ :ansopt:`bar.baz[123].bam[len(x) - 1]=bar`\
+ parse_opts:
+ current_plugin:
+ fqcn: foo.bar.baz
+ type: role
+ role_entrypoint: main
return_value_no_current_plugin:
source:
- |-
@@ -557,9 +841,9 @@ test_vectors:
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
md_opts:
pluginOptionLikeLink.js: |-
- (plugin, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}-${name.join('/')}`
+ (plugin, entrypoint, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}${entrypoint ? '-' + entrypoint : ''}-${name.join('/')}`
pluginOptionLikeLink.py: |-
- lambda plugin, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}-{'/'.join(name)}"
+ lambda plugin, entrypoint, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}{'-' + entrypoint if entrypoint else ''}-{'/'.join(name)}"
rst: |-
\ :ansretval:`foo`\ \ :ansretval:`bar.baz[123].bam[len(x) - 1]`\
@@ -627,9 +911,9 @@ test_vectors:
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo
bar.baz[123].bam[len(x) - 1]
foo=
bar.baz[123].bam[len(x) - 1]=
foo=bar
bar.baz[123].bam[len(x) - 1]=bar
foo\=bar
bar.baz\[123\].bam\[len\(x\) \- 1\]\=bar
md_opts:
pluginOptionLikeLink.js: |-
- (plugin, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}-${name.join('/')}`
+ (plugin, entrypoint, what, name, current_plugin) => `https://docs.ansible.com/ansible/devel/collections/${plugin.fqcn.replace(/\./g, '/')}_${plugin.type}.html#${what}${entrypoint ? '-' + entrypoint : ''}-${name.join('/')}`
pluginOptionLikeLink.py: |-
- lambda plugin, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}-{'/'.join(name)}"
+ lambda plugin, entrypoint, what, name, current_plugin: f"https://docs.ansible.com/ansible/devel/collections/{plugin.fqcn.replace('.', '/')}_{plugin.type}.html#{what}{'-' + entrypoint if entrypoint else ''}-{'/'.join(name)}"
rst: |-
\ :ansretval:`foo.bar.baz.bam#boo:foo`\ \ :ansretval:`foo.bar.baz.bam#boo:bar.baz[123].bam[len(x) - 1]`\
diff --git a/tests/unit/test_dom.py b/tests/unit/test_dom.py
index a543497..51d964a 100644
--- a/tests/unit/test_dom.py
+++ b/tests/unit/test_dom.py
@@ -107,10 +107,16 @@ def process_return_value(self, part: dom.ReturnValuePart) -> None:
dom.TextPart(text=" baz "),
dom.OptionValuePart(value=" b,na)\\m, "),
dom.TextPart(text=" "),
- dom.OptionNamePart(plugin=None, link=["foo"], name="foo", value=None),
+ dom.OptionNamePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value=None
+ ),
dom.TextPart(text=" "),
dom.ReturnValuePart(
- plugin=None, link=["bar", "baz"], name="bar.baz[1]", value=None
+ plugin=None,
+ entrypoint=None,
+ link=["bar", "baz"],
+ name="bar.baz[1]",
+ value=None,
),
],
]
diff --git a/tests/unit/test_parser.py b/tests/unit/test_parser.py
index b9e29a3..15f0a83 100644
--- a/tests/unit/test_parser.py
+++ b/tests/unit/test_parser.py
@@ -86,7 +86,9 @@
dom.TextPart(text=" baz "),
dom.OptionValuePart(value=" b,na)\\m, "),
dom.TextPart(text=" "),
- dom.OptionNamePart(plugin=None, link=["foo"], name="foo", value=None),
+ dom.OptionNamePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value=None
+ ),
dom.TextPart(text=" "),
],
],
@@ -98,7 +100,9 @@
{},
[
[
- dom.OptionNamePart(plugin=None, link=["foo"], name="foo", value=None),
+ dom.OptionNamePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value=None
+ ),
],
],
),
@@ -108,7 +112,9 @@
{},
[
[
- dom.OptionNamePart(plugin=None, link=["foo"], name="foo", value=None),
+ dom.OptionNamePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value=None
+ ),
],
],
),
@@ -120,6 +126,7 @@
[
dom.OptionNamePart(
plugin=dom.PluginIdentifier("foo.bar.baz", type="bam"),
+ entrypoint=None,
link=["foo"],
name="foo",
value=None,
@@ -135,6 +142,7 @@
[
dom.OptionNamePart(
plugin=dom.PluginIdentifier("foo.bar.baz", type="bam"),
+ entrypoint=None,
link=["foo"],
name="foo",
value=None,
@@ -148,7 +156,9 @@
{},
[
[
- dom.OptionNamePart(plugin=None, link=["foo"], name="foo", value="bar"),
+ dom.OptionNamePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value="bar"
+ ),
],
],
),
@@ -159,7 +169,11 @@
[
[
dom.OptionNamePart(
- plugin=None, link=["foo", "baz"], name="foo.baz", value="bam"
+ plugin=None,
+ entrypoint=None,
+ link=["foo", "baz"],
+ name="foo.baz",
+ value="bam",
),
],
],
@@ -172,6 +186,7 @@
[
dom.OptionNamePart(
plugin=None,
+ entrypoint=None,
link=["foo", "baz", "boo"],
name="foo[1].baz[bam.bar.boing].boo",
value=None,
@@ -187,6 +202,7 @@
[
dom.OptionNamePart(
plugin=dom.PluginIdentifier("bar.baz.bam.boo", type="lookup"),
+ entrypoint=None,
link=["foo", "baz", "boo"],
name="foo[1].baz[bam.bar.boing].boo",
value=None,
@@ -201,7 +217,9 @@
{},
[
[
- dom.ReturnValuePart(plugin=None, link=["foo"], name="foo", value=None),
+ dom.ReturnValuePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value=None
+ ),
],
],
),
@@ -211,7 +229,9 @@
{},
[
[
- dom.ReturnValuePart(plugin=None, link=["foo"], name="foo", value=None),
+ dom.ReturnValuePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value=None
+ ),
],
],
),
@@ -223,6 +243,7 @@
[
dom.ReturnValuePart(
plugin=dom.PluginIdentifier("foo.bar.baz", type="bam"),
+ entrypoint=None,
link=["foo"],
name="foo",
value=None,
@@ -238,6 +259,7 @@
[
dom.ReturnValuePart(
plugin=dom.PluginIdentifier("foo.bar.baz", type="bam"),
+ entrypoint=None,
link=["foo"],
name="foo",
value=None,
@@ -251,7 +273,9 @@
{},
[
[
- dom.ReturnValuePart(plugin=None, link=["foo"], name="foo", value="bar"),
+ dom.ReturnValuePart(
+ plugin=None, entrypoint=None, link=["foo"], name="foo", value="bar"
+ ),
],
],
),
@@ -262,7 +286,11 @@
[
[
dom.ReturnValuePart(
- plugin=None, link=["foo", "baz"], name="foo.baz", value="bam"
+ plugin=None,
+ entrypoint=None,
+ link=["foo", "baz"],
+ name="foo.baz",
+ value="bam",
),
],
],
@@ -275,6 +303,7 @@
[
dom.ReturnValuePart(
plugin=None,
+ entrypoint=None,
link=["foo", "baz", "boo"],
name="foo[1].baz[bam.bar.boing].boo",
value=None,
@@ -290,6 +319,7 @@
[
dom.ReturnValuePart(
plugin=dom.PluginIdentifier("bar.baz.bam.boo", type="lookup"),
+ entrypoint=None,
link=["foo", "baz", "boo"],
name="foo[1].baz[bam.bar.boing].boo",
value=None,
@@ -509,6 +539,18 @@
],
],
),
+ (
+ "O(foo.bar.baz#role:bam)",
+ Context(),
+ dict(errors="message"),
+ [
+ [
+ dom.ErrorPart(
+ message="While parsing O() at index 1: Role reference is missing entrypoint"
+ ),
+ ],
+ ],
+ ),
# bad parameter parsing (no escaping, ignore error):
("M(", Context(), dict(errors="ignore"), [[]]),
("M(foo", Context(), dict(errors="ignore"), [[]]),
@@ -517,6 +559,7 @@
("L(foo), bar", Context(), dict(errors="ignore"), [[]]),
("P(", Context(), dict(errors="ignore"), [[]]),
("P(foo", Context(), dict(errors="ignore"), [[]]),
+ ("O(foo.bar.baz#role:bam)", Context(), dict(errors="ignore"), [[]]),
# bad module ref (ignore error):
("M(foo)", Context(), dict(errors="ignore"), [[]]),
(" M(foo.bar)", Context(), dict(errors="ignore"), [[dom.TextPart(text=" ")]]),
@@ -669,6 +712,12 @@ def test_parse(
dict(errors="exception"),
'While parsing O() at index 1: Invalid option/return value name "foo:bar:baz"',
),
+ (
+ "O(foo.bar.baz#role:bam)",
+ Context(),
+ dict(errors="exception"),
+ "While parsing O() at index 1: Role reference is missing entrypoint",
+ ),
]
diff --git a/tests/unit/test_vectors.py b/tests/unit/test_vectors.py
index e892991..13ab9e8 100644
--- a/tests/unit/test_vectors.py
+++ b/tests/unit/test_vectors.py
@@ -40,12 +40,15 @@ def plugin_link(self, plugin: dom.PluginIdentifier) -> t.Optional[str]:
def plugin_option_like_link(
self,
plugin: dom.PluginIdentifier,
+ entrypoint: t.Optional[str],
what: "t.Union[t.Literal['option'], t.Literal['retval']]",
name: t.List[str],
current_plugin: bool,
) -> t.Optional[str]:
if self._plugin_option_like_link is not None:
- return self._plugin_option_like_link(plugin, what, name, current_plugin)
+ return self._plugin_option_like_link(
+ plugin, entrypoint, what, name, current_plugin
+ )
return None
def _update(self, config: t.Mapping[str, t.Any]):
@@ -72,6 +75,8 @@ def test_vectors(test_name: str, test_data: t.Mapping[str, t.Any]) -> None:
fqcn=test_data["parse_opts"]["current_plugin"]["fqcn"],
type=test_data["parse_opts"]["current_plugin"]["type"],
)
+ if "role_entrypoint" in test_data["parse_opts"]:
+ context_opts["role_entrypoint"] = test_data["parse_opts"]["role_entrypoint"]
if "errors" in test_data["parse_opts"]:
context_opts["errors"] = test_data["parse_opts"]["errors"]
if "onlyClassicMarkup" in test_data["parse_opts"]: