From 1b05cc2e7d7a6cacb445be58f8b5a88a733111e0 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 19 Aug 2023 16:30:21 +0200 Subject: [PATCH] Fix nested option/return value indent when using LaTeX builder. --- changelogs/fragments/195-problems.yml | 4 ++-- changelogs/fragments/198-latex-indent.yml | 2 ++ .../ansible-docsite/macros/parameters.rst.j2 | 12 ++++++++++++ .../ansible-docsite/macros/returnvalues.rst.j2 | 12 ++++++++++++ .../collections/ns/col2/foo2_module.rst | 16 ++++++++++++++++ .../collections/ns/col2/foo3_module.rst | 8 ++++++++ .../collections/ns2/col/foo_module.rst | 8 ++++++++ .../collections/ns2/flatcol/foo_module.rst | 8 ++++++++ .../collections/ns/col2/foo2_module.rst | 16 ++++++++++++++++ .../collections/ns/col2/foo3_module.rst | 8 ++++++++ .../collections/ns2/col/foo_module.rst | 8 ++++++++ .../collections/ns2/flatcol/foo_module.rst | 8 ++++++++ .../collections/ns2/col/foo_module.rst | 8 ++++++++ .../collections/ns2/flatcol/foo_module.rst | 8 ++++++++ .../baseline-squash-hierarchy/foo_module.rst | 8 ++++++++ 15 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/198-latex-indent.yml diff --git a/changelogs/fragments/195-problems.yml b/changelogs/fragments/195-problems.yml index 65daf3db..cc43e056 100644 --- a/changelogs/fragments/195-problems.yml +++ b/changelogs/fragments/195-problems.yml @@ -1,3 +1,3 @@ known_issues: - - "When using Sphinx builders other than HTML, the indentation for nested options and return values is missing, - and the collection links section is empty (https://github.com/ansible-community/antsibull-docs/pull/195)." + - "When using Sphinx builders other than HTML, the collection links section is empty (https://github.com/ansible-community/antsibull-docs/pull/195)." + - "When using Sphinx builders other than HTML and LaTeX, the indentation for nested options and return values is missing (https://github.com/ansible-community/antsibull-docs/pull/195)." diff --git a/changelogs/fragments/198-latex-indent.yml b/changelogs/fragments/198-latex-indent.yml new file mode 100644 index 00000000..0d88e614 --- /dev/null +++ b/changelogs/fragments/198-latex-indent.yml @@ -0,0 +1,2 @@ +minor_changes: + - "Fix indent for nested options and return values with Spinx's LaTeX builder (https://github.com/ansible-community/antsibull-docs/pull/198)." diff --git a/src/antsibull_docs/data/docsite/ansible-docsite/macros/parameters.rst.j2 b/src/antsibull_docs/data/docsite/ansible-docsite/macros/parameters.rst.j2 index b8122c9c..c1f2a099 100644 --- a/src/antsibull_docs/data/docsite/ansible-docsite/macros/parameters.rst.j2 +++ b/src/antsibull_docs/data/docsite/ansible-docsite/macros/parameters.rst.j2 @@ -30,6 +30,12 @@ {% for full_key in value['full_keys'] %}
{% endfor %} +{% if loop.depth > 1 %} + + .. raw:: latex + + \hspace{@{ 0.02 * loop.depth0 }@\textwidth}\begin{minipage}[t]{@{ 0.32 - 0.02 * loop.depth0 }@\textwidth} +{% endif %} {% for full_key in value['full_keys_rst'] %} .. _ansible_collections.@{plugin_name}@_@{plugin_type}@__parameter-@{ parameter_rst_prefix }@{% for part in full_key %}@{ part }@{% if not loop.last %}/{% endif %}{% endfor %}: @@ -69,6 +75,12 @@ .. raw:: html +{% if loop.depth > 1 %} + + .. raw:: latex + + \end{minipage} +{% endif %} {# description #} - .. raw:: html diff --git a/src/antsibull_docs/data/docsite/ansible-docsite/macros/returnvalues.rst.j2 b/src/antsibull_docs/data/docsite/ansible-docsite/macros/returnvalues.rst.j2 index 6c2b80e3..55d218ff 100644 --- a/src/antsibull_docs/data/docsite/ansible-docsite/macros/returnvalues.rst.j2 +++ b/src/antsibull_docs/data/docsite/ansible-docsite/macros/returnvalues.rst.j2 @@ -28,6 +28,12 @@ {% for full_key in value['full_keys'] %}
{% endfor %} +{% if loop.depth > 1 %} + + .. raw:: latex + + \hspace{@{ 0.02 * loop.depth0 }@\textwidth}\begin{minipage}[t]{@{ 0.32 - 0.02 * loop.depth0 }@\textwidth} +{% endif %} {% for full_key in value['full_keys_rst'] %} .. _ansible_collections.@{plugin_name}@_@{plugin_type}@__return-{% for part in full_key %}@{ part }@{% if not loop.last %}/{% endif %}{% endfor %}: @@ -56,6 +62,12 @@ .. raw:: html +{% if loop.depth > 1 %} + + .. raw:: latex + + \end{minipage} +{% endif %} - .. raw:: html diff --git a/tests/functional/baseline-default/collections/ns/col2/foo2_module.rst b/tests/functional/baseline-default/collections/ns/col2/foo2_module.rst index 64bb0c77..f40d2e9a 100644 --- a/tests/functional/baseline-default/collections/ns/col2/foo2_module.rst +++ b/tests/functional/baseline-default/collections/ns/col2/foo2_module.rst @@ -212,6 +212,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns.col2.foo2_module__parameter-subfoo/baz: .. rst-class:: ansible-option-title @@ -230,6 +234,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
@@ -246,6 +254,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns.col2.foo2_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -264,6 +276,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-default/collections/ns/col2/foo3_module.rst b/tests/functional/baseline-default/collections/ns/col2/foo3_module.rst index 3358c920..8b4aaca0 100644 --- a/tests/functional/baseline-default/collections/ns/col2/foo3_module.rst +++ b/tests/functional/baseline-default/collections/ns/col2/foo3_module.rst @@ -205,6 +205,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns.col2.foo3_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -223,6 +227,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-default/collections/ns2/col/foo_module.rst b/tests/functional/baseline-default/collections/ns2/col/foo_module.rst index 65a67243..96947a7a 100644 --- a/tests/functional/baseline-default/collections/ns2/col/foo_module.rst +++ b/tests/functional/baseline-default/collections/ns2/col/foo_module.rst @@ -225,6 +225,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns2.col.foo_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -243,6 +247,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-default/collections/ns2/flatcol/foo_module.rst b/tests/functional/baseline-default/collections/ns2/flatcol/foo_module.rst index 33033571..97238d2a 100644 --- a/tests/functional/baseline-default/collections/ns2/flatcol/foo_module.rst +++ b/tests/functional/baseline-default/collections/ns2/flatcol/foo_module.rst @@ -221,6 +221,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns2.flatcol.foo_module__parameter-subbaz/bam: .. _ansible_collections.ns2.flatcol.foo_module__parameter-subbaz/foo: .. _ansible_collections.ns2.flatcol.foo_module__parameter-subfoo/bam: @@ -246,6 +250,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo2_module.rst b/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo2_module.rst index 64bb0c77..f40d2e9a 100644 --- a/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo2_module.rst +++ b/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo2_module.rst @@ -212,6 +212,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns.col2.foo2_module__parameter-subfoo/baz: .. rst-class:: ansible-option-title @@ -230,6 +234,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
@@ -246,6 +254,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns.col2.foo2_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -264,6 +276,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo3_module.rst b/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo3_module.rst index 3358c920..8b4aaca0 100644 --- a/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo3_module.rst +++ b/tests/functional/baseline-no-breadcrumbs/collections/ns/col2/foo3_module.rst @@ -205,6 +205,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns.col2.foo3_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -223,6 +227,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_module.rst b/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_module.rst index 65a67243..96947a7a 100644 --- a/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_module.rst +++ b/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/foo_module.rst @@ -225,6 +225,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns2.col.foo_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -243,6 +247,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-no-breadcrumbs/collections/ns2/flatcol/foo_module.rst b/tests/functional/baseline-no-breadcrumbs/collections/ns2/flatcol/foo_module.rst index 33033571..97238d2a 100644 --- a/tests/functional/baseline-no-breadcrumbs/collections/ns2/flatcol/foo_module.rst +++ b/tests/functional/baseline-no-breadcrumbs/collections/ns2/flatcol/foo_module.rst @@ -221,6 +221,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns2.flatcol.foo_module__parameter-subbaz/bam: .. _ansible_collections.ns2.flatcol.foo_module__parameter-subbaz/foo: .. _ansible_collections.ns2.flatcol.foo_module__parameter-subfoo/bam: @@ -246,6 +250,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-no-indexes/collections/ns2/col/foo_module.rst b/tests/functional/baseline-no-indexes/collections/ns2/col/foo_module.rst index 65a67243..96947a7a 100644 --- a/tests/functional/baseline-no-indexes/collections/ns2/col/foo_module.rst +++ b/tests/functional/baseline-no-indexes/collections/ns2/col/foo_module.rst @@ -225,6 +225,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns2.col.foo_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -243,6 +247,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-no-indexes/collections/ns2/flatcol/foo_module.rst b/tests/functional/baseline-no-indexes/collections/ns2/flatcol/foo_module.rst index 33033571..97238d2a 100644 --- a/tests/functional/baseline-no-indexes/collections/ns2/flatcol/foo_module.rst +++ b/tests/functional/baseline-no-indexes/collections/ns2/flatcol/foo_module.rst @@ -221,6 +221,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns2.flatcol.foo_module__parameter-subbaz/bam: .. _ansible_collections.ns2.flatcol.foo_module__parameter-subbaz/foo: .. _ansible_collections.ns2.flatcol.foo_module__parameter-subfoo/bam: @@ -246,6 +250,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html
diff --git a/tests/functional/baseline-squash-hierarchy/foo_module.rst b/tests/functional/baseline-squash-hierarchy/foo_module.rst index 65a67243..96947a7a 100644 --- a/tests/functional/baseline-squash-hierarchy/foo_module.rst +++ b/tests/functional/baseline-squash-hierarchy/foo_module.rst @@ -225,6 +225,10 @@ Parameters
+ .. raw:: latex + + \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth} + .. _ansible_collections.ns2.col.foo_module__parameter-subfoo/foo: .. rst-class:: ansible-option-title @@ -243,6 +247,10 @@ Parameters
+ .. raw:: latex + + \end{minipage} + - .. raw:: html