From f9316748b61b49e77cfa2c05dc802248c46cb76a Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 29 Dec 2024 15:53:34 +0100 Subject: [PATCH] Fix role docs section levels (#367) * Fix role docs section levels. * Collection links should stay as before, so they do not show up in TOC, same as for plugins. --- changelogs/fragments/367-role-headings.yml | 3 +++ src/antsibull_docs/data/docsite/ansible-docsite/role.rst.j2 | 4 ++-- src/antsibull_docs/data/docsite/simplified-rst/role.rst.j2 | 4 ++-- .../baseline-default/collections/ns/col2/bar_role.rst | 2 +- .../baseline-default/collections/ns2/col/foo_role.rst | 4 ++-- .../baseline-no-breadcrumbs/collections/ns/col2/bar_role.rst | 2 +- .../baseline-no-breadcrumbs/collections/ns2/col/foo_role.rst | 4 ++-- .../baseline-no-indexes/collections/ns2/col/foo_role.rst | 4 ++-- .../baseline-simplified-rst-squash-hierarchy/foo_role.rst | 4 ++-- .../baseline-simplified-rst/collections/ns/col2/bar_role.rst | 2 +- .../baseline-simplified-rst/collections/ns2/col/foo_role.rst | 4 ++-- tests/functional/baseline-squash-hierarchy/foo_role.rst | 4 ++-- .../baseline-use-html-blobs/collections/ns2/col/foo_role.rst | 4 ++-- 13 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 changelogs/fragments/367-role-headings.yml diff --git a/changelogs/fragments/367-role-headings.yml b/changelogs/fragments/367-role-headings.yml new file mode 100644 index 00000000..84f4a8ab --- /dev/null +++ b/changelogs/fragments/367-role-headings.yml @@ -0,0 +1,3 @@ +bugfixes: + - "Fix role section heading levels. Examples and attributes should be below role entrypoints + (https://github.com/ansible-community/antsibull-docs/issues/366, https://github.com/ansible-community/antsibull-docs/pull/367)." diff --git a/src/antsibull_docs/data/docsite/ansible-docsite/role.rst.j2 b/src/antsibull_docs/data/docsite/ansible-docsite/role.rst.j2 index 73694acc..df297348 100644 --- a/src/antsibull_docs/data/docsite/ansible-docsite/role.rst.j2 +++ b/src/antsibull_docs/data/docsite/ansible-docsite/role.rst.j2 @@ -144,7 +144,7 @@ Parameters {% if ep_doc['attributes'] %} Attributes ----------- +^^^^^^^^^^ @{ attributes_rst(ep_doc['attributes'], attribute_html_prefix=entry_point ~ '--', role_entrypoint=entry_point) }@ {% endif %} @@ -194,7 +194,7 @@ See Also {% if ep_doc['examples'] and ep_doc['examples'] | trim -%} Examples --------- +^^^^^^^^ .. code-block:: @{ ep_doc['examples_format'] | rst_format(for_sphinx=true) }@ diff --git a/src/antsibull_docs/data/docsite/simplified-rst/role.rst.j2 b/src/antsibull_docs/data/docsite/simplified-rst/role.rst.j2 index 0c697aa2..00257613 100644 --- a/src/antsibull_docs/data/docsite/simplified-rst/role.rst.j2 +++ b/src/antsibull_docs/data/docsite/simplified-rst/role.rst.j2 @@ -103,7 +103,7 @@ Parameters {% if ep_doc['attributes'] %} Attributes ----------- +^^^^^^^^^^ @{ attributes_rst(ep_doc['attributes'], role_entrypoint=entry_point) }@ {% endif %} @@ -152,7 +152,7 @@ See Also {% if ep_doc['examples'] and ep_doc['examples'] | trim -%} Examples --------- +^^^^^^^^ .. code-block:: @{ ep_doc['examples_format'] | rst_format }@ diff --git a/tests/functional/baseline-default/collections/ns/col2/bar_role.rst b/tests/functional/baseline-default/collections/ns/col2/bar_role.rst index 131663ea..b4f7dcbe 100644 --- a/tests/functional/baseline-default/collections/ns/col2/bar_role.rst +++ b/tests/functional/baseline-default/collections/ns/col2/bar_role.rst @@ -68,7 +68,7 @@ Synopsis Examples --------- +^^^^^^^^ .. code-block:: yaml+jinja diff --git a/tests/functional/baseline-default/collections/ns2/col/foo_role.rst b/tests/functional/baseline-default/collections/ns2/col/foo_role.rst index 39e515a2..4bfc4c1b 100644 --- a/tests/functional/baseline-default/collections/ns2/col/foo_role.rst +++ b/tests/functional/baseline-default/collections/ns2/col/foo_role.rst @@ -170,7 +170,7 @@ Parameters Attributes ----------- +^^^^^^^^^^ .. tabularcolumns:: \X{2}{10}\X{3}{10}\X{5}{10} @@ -283,7 +283,7 @@ See Also The official documentation on the **ns2.col.foo** module. Examples --------- +^^^^^^^^ .. code-block:: yaml+jinja diff --git a/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/bar_role.rst b/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/bar_role.rst index 131663ea..b4f7dcbe 100644 --- a/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/bar_role.rst +++ b/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/bar_role.rst @@ -68,7 +68,7 @@ Synopsis Examples --------- +^^^^^^^^ .. code-block:: yaml+jinja diff --git a/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_role.rst b/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_role.rst index 39e515a2..4bfc4c1b 100644 --- a/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_role.rst +++ b/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_role.rst @@ -170,7 +170,7 @@ Parameters Attributes ----------- +^^^^^^^^^^ .. tabularcolumns:: \X{2}{10}\X{3}{10}\X{5}{10} @@ -283,7 +283,7 @@ See Also The official documentation on the **ns2.col.foo** module. Examples --------- +^^^^^^^^ .. code-block:: yaml+jinja diff --git a/tests/functional/baseline-no-indexes/collections/ns2/col/foo_role.rst b/tests/functional/baseline-no-indexes/collections/ns2/col/foo_role.rst index 70eaa98c..68655fa4 100644 --- a/tests/functional/baseline-no-indexes/collections/ns2/col/foo_role.rst +++ b/tests/functional/baseline-no-indexes/collections/ns2/col/foo_role.rst @@ -167,7 +167,7 @@ Parameters Attributes ----------- +^^^^^^^^^^ .. tabularcolumns:: \X{2}{10}\X{3}{10}\X{5}{10} @@ -280,7 +280,7 @@ See Also The official documentation on the **ns2.col.foo** module. Examples --------- +^^^^^^^^ .. code-block:: yaml+jinja diff --git a/tests/functional/baseline-simplified-rst-squash-hierarchy/foo_role.rst b/tests/functional/baseline-simplified-rst-squash-hierarchy/foo_role.rst index 7c50e5cc..9bdf0e26 100644 --- a/tests/functional/baseline-simplified-rst-squash-hierarchy/foo_role.rst +++ b/tests/functional/baseline-simplified-rst-squash-hierarchy/foo_role.rst @@ -89,7 +89,7 @@ Parameters Attributes ----------- +^^^^^^^^^^ .. list-table:: :widths: auto @@ -134,7 +134,7 @@ See Also The official documentation on the **ns2.col.foo** module. Examples --------- +^^^^^^^^ .. code-block:: yaml diff --git a/tests/functional/baseline-simplified-rst/collections/ns/col2/bar_role.rst b/tests/functional/baseline-simplified-rst/collections/ns/col2/bar_role.rst index 12583b23..a1c01f9d 100644 --- a/tests/functional/baseline-simplified-rst/collections/ns/col2/bar_role.rst +++ b/tests/functional/baseline-simplified-rst/collections/ns/col2/bar_role.rst @@ -33,7 +33,7 @@ Synopsis Examples --------- +^^^^^^^^ .. code-block:: yaml diff --git a/tests/functional/baseline-simplified-rst/collections/ns2/col/foo_role.rst b/tests/functional/baseline-simplified-rst/collections/ns2/col/foo_role.rst index 5e13c624..36496572 100644 --- a/tests/functional/baseline-simplified-rst/collections/ns2/col/foo_role.rst +++ b/tests/functional/baseline-simplified-rst/collections/ns2/col/foo_role.rst @@ -89,7 +89,7 @@ Parameters Attributes ----------- +^^^^^^^^^^ .. list-table:: :widths: auto @@ -134,7 +134,7 @@ See Also The official documentation on the **ns2.col.foo** module. Examples --------- +^^^^^^^^ .. code-block:: yaml diff --git a/tests/functional/baseline-squash-hierarchy/foo_role.rst b/tests/functional/baseline-squash-hierarchy/foo_role.rst index 39e515a2..4bfc4c1b 100644 --- a/tests/functional/baseline-squash-hierarchy/foo_role.rst +++ b/tests/functional/baseline-squash-hierarchy/foo_role.rst @@ -170,7 +170,7 @@ Parameters Attributes ----------- +^^^^^^^^^^ .. tabularcolumns:: \X{2}{10}\X{3}{10}\X{5}{10} @@ -283,7 +283,7 @@ See Also The official documentation on the **ns2.col.foo** module. Examples --------- +^^^^^^^^ .. code-block:: yaml+jinja diff --git a/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_role.rst b/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_role.rst index ac2eb760..38ef030b 100644 --- a/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_role.rst +++ b/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_role.rst @@ -123,7 +123,7 @@ Parameters Attributes ----------- +^^^^^^^^^^ .. tabularcolumns:: \X{2}{10}\X{3}{10}\X{5}{10} @@ -236,7 +236,7 @@ See Also The official documentation on the **ns2.col.foo** module. Examples --------- +^^^^^^^^ .. code-block:: yaml+jinja