Skip to content

Commit

Permalink
Fix internal option/return value links for simplified RST output.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Apr 7, 2024
1 parent 6ec5b11 commit a63d77f
Show file tree
Hide file tree
Showing 28 changed files with 32 additions and 31 deletions.
1 change: 1 addition & 0 deletions changelogs/fragments/269-refs.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bugfixes:
- "Fix internal links to options and return values in simplified RST output (https://github.com/ansible-community/antsibull-docs/pull/269)."
- "Include role in role attribute references (https://github.com/ansible-community/antsibull-docs/pull/269)."
4 changes: 2 additions & 2 deletions src/antsibull_docs/markup/rstify.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def plugin_option_like_link(
) -> t.Optional[str]:
if current_plugin:
ref = massage_rst_label("/".join(name))
ep = f"{entrypoint}__" if entrypoint is not None else ""
ep = f"{entrypoint}--" if entrypoint is not None else ""
prefix = "return" if what == "retval" else "parameter"
return f"{prefix}-{ep}{ref}_"
return self.plugin_link(plugin)
Expand All @@ -83,7 +83,7 @@ def _custom_format_option_like(
) -> str:
plugin = part.plugin
if url and url.endswith("_"):
plugin_text = f" (`link <{url}>`_)"
plugin_text = f" (`link <#{url[:-1]}>`_)"
elif plugin:
plugin_result = [plugin.type]
if plugin.type not in ("module", "role", "playbook"):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo become -- Use foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo become -- Use foo \ :literal:`bar` (`link <#parameter-bar>`_)\
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This become plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo cache -- Foo files \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo cache -- Foo files \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This cache plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo callback -- Foo output \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo callback -- Foo output \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This callback plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo connection -- Foo connection \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo connection -- Foo connection \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This connection plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo filter -- The foo filter \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo filter -- The foo filter \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This filter plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo inventory -- The foo inventory \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo inventory -- The foo inventory \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This inventory plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo lookup -- Look up some foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo lookup -- Look up some foo \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This lookup plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo module -- Do some foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo module -- Do some foo \ :literal:`bar` (`link <#parameter-bar>`_)\
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This module is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down Expand Up @@ -199,7 +199,7 @@ See Also
Another foo.
* \ `ns2.col.foo <foo_lookup.rst>`__\ lookup plugin

Look up some foo \ :literal:`bar` (`link <parameter-bar_>`_)\ .
Look up some foo \ :literal:`bar` (`link <#parameter-bar>`_)\ .
* \ `ansible.builtin.service <service_module.rst>`__\

The service module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Synopsis
^^^^^^^^

- This is the foo role.
- If you set \ :literal:`foo\_param\_1` (`link <parameter-main__foo_param_1_>`_)\ while \ :literal:`foo\_param\_2=3` (`link <parameter-main__foo_param_2_>`_)\ , this might behave funny.
- If you set \ :literal:`foo\_param\_1` (`link <#parameter-main--foo_param_1>`_)\ while \ :literal:`foo\_param\_2=3` (`link <#parameter-main--foo_param_2>`_)\ , this might behave funny.


Parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo shell -- Foo shell \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo shell -- Foo shell \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This shell plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo test -- Is something a foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo test -- Is something a foo \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This test plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo vars -- Load foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo vars -- Load foo \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This vars plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Synopsis

- Does some foo on the remote host.
- A broken reference \ :ref:`asdfasdfoobarTHISDOESNOTEXIST <asdfasdfoobarTHISDOESNOTEXIST>`\ .
- The option \ :literal:`foo` (`link <parameter-foo_>`_)\ exists, but \ :literal:`foobar` (`link <parameter-foobar_>`_)\ does not.
- The return value \ :literal:`bar` (`link <return-bar_>`_)\ exists, but \ :literal:`barbaz` (`link <return-barbaz_>`_)\ does not.
- The option \ :literal:`foo` (`link <#parameter-foo>`_)\ exists, but \ :literal:`foobar` (`link <#parameter-foobar>`_)\ does not.
- The return value \ :literal:`bar` (`link <#return-bar>`_)\ exists, but \ :literal:`barbaz` (`link <#return-barbaz>`_)\ does not.
- Again existing: \ :literal:`foo=1` (of module `ns.col2.foo <foo_module.rst>`__)\ , \ :literal:`bar=2` (of module `ns.col2.foo <foo_module.rst>`__)\
- Again not existing: \ :literal:`foobar=1` (of module `ns.col2.foo <foo_module.rst>`__)\ , \ :literal:`barbaz=2` (of module `ns.col2.foo <foo_module.rst>`__)\

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo become -- Use foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo become -- Use foo \ :literal:`bar` (`link <#parameter-bar>`_)\
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This become plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo cache -- Foo files \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo cache -- Foo files \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This cache plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo callback -- Foo output \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo callback -- Foo output \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This callback plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo connection -- Foo connection \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo connection -- Foo connection \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This connection plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo filter -- The foo filter \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo filter -- The foo filter \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This filter plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo inventory -- The foo inventory \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo inventory -- The foo inventory \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This inventory plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo lookup -- Look up some foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo lookup -- Look up some foo \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This lookup plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo module -- Do some foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo module -- Do some foo \ :literal:`bar` (`link <#parameter-bar>`_)\
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This module is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down Expand Up @@ -199,7 +199,7 @@ See Also
Another foo.
* \ `ns2.col.foo <foo_lookup.rst>`__\ lookup plugin

Look up some foo \ :literal:`bar` (`link <parameter-bar_>`_)\ .
Look up some foo \ :literal:`bar` (`link <#parameter-bar>`_)\ .
* \ `ansible.builtin.service <service_module.rst>`__\

The service module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Synopsis
^^^^^^^^

- This is the foo role.
- If you set \ :literal:`foo\_param\_1` (`link <parameter-main__foo_param_1_>`_)\ while \ :literal:`foo\_param\_2=3` (`link <parameter-main__foo_param_2_>`_)\ , this might behave funny.
- If you set \ :literal:`foo\_param\_1` (`link <#parameter-main--foo_param_1>`_)\ while \ :literal:`foo\_param\_2=3` (`link <#parameter-main--foo_param_2>`_)\ , this might behave funny.


Parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo shell -- Foo shell \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo shell -- Foo shell \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This shell plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo test -- Is something a foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo test -- Is something a foo \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This test plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.col.foo vars -- Load foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.col.foo vars -- Load foo \ :literal:`bar` (`link <#parameter-bar>`_)\
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This vars plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.. Created with antsibull-docs <ANTSIBULL_DOCS_VERSION>
ns2.flatcol.foo module -- Do some foo \ :literal:`bar` (`link <parameter-bar_>`_)\
ns2.flatcol.foo module -- Do some foo \ :literal:`bar` (`link <#parameter-bar>`_)\
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This module is part of the `ns2.flatcol collection <https://galaxy.ansible.com/ui/repo/published/ns2/flatcol/>`_.
Expand Down

0 comments on commit a63d77f

Please sign in to comment.