Skip to content

Commit

Permalink
Fix nested option/return value indent when using LaTeX builder.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Aug 19, 2023
1 parent 9f69542 commit 1f09295
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 2 deletions.
4 changes: 2 additions & 2 deletions changelogs/fragments/195-problems.yml
Original file line number Diff line number Diff line change
@@ -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)."
2 changes: 2 additions & 0 deletions changelogs/fragments/198-latex-indent.yml
Original file line number Diff line number Diff line change
@@ -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)."
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
{% for full_key in value['full_keys'] %}
<div class="ansibleOptionAnchor" id="parameter-@{ parameter_html_prefix }@{% for part in full_key %}@{ part | urlencode }@{% if not loop.last %}/{% endif %}{% endfor %}"></div>
{% 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 %}:
Expand Down Expand Up @@ -69,6 +75,12 @@
.. raw:: html

</div>
{% if loop.depth > 1 %}

.. raw:: latex

\end{minipage}
{% endif %}

{# description #}
- .. raw:: html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
{% for full_key in value['full_keys'] %}
<div class="ansibleOptionAnchor" id="return-{% for part in full_key %}@{ part | urlencode }@{% if not loop.last %}/{% endif %}{% endfor %}"></div>
{% 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 %}:
Expand Down Expand Up @@ -56,6 +62,12 @@
.. raw:: html

</div>
{% if loop.depth > 1 %}

.. raw:: latex

\end{minipage}
{% endif %}

- .. raw:: html

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/BaZ"></div>

.. 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
Expand All @@ -230,6 +234,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand All @@ -246,6 +254,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -264,6 +276,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -223,6 +227,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -243,6 +247,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ Parameters
<div class="ansibleOptionAnchor" id="parameter-subfoo/bam"></div>
<div class="ansibleOptionAnchor" id="parameter-subbaz/bam"></div>

.. 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:
Expand All @@ -246,6 +250,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/BaZ"></div>

.. 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
Expand All @@ -230,6 +234,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand All @@ -246,6 +254,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -264,6 +276,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -223,6 +227,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -243,6 +247,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ Parameters
<div class="ansibleOptionAnchor" id="parameter-subfoo/bam"></div>
<div class="ansibleOptionAnchor" id="parameter-subbaz/bam"></div>

.. 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:
Expand All @@ -246,6 +250,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -243,6 +247,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ Parameters
<div class="ansibleOptionAnchor" id="parameter-subfoo/bam"></div>
<div class="ansibleOptionAnchor" id="parameter-subbaz/bam"></div>

.. 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:
Expand All @@ -246,6 +250,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down
8 changes: 8 additions & 0 deletions tests/functional/baseline-squash-hierarchy/foo_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ Parameters
<div class="ansible-option-indent"></div><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-subfoo/foo"></div>

.. 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
Expand All @@ -243,6 +247,10 @@ Parameters

</div>

.. raw:: latex

\end{minipage}

- .. raw:: html

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">
Expand Down

0 comments on commit 1f09295

Please sign in to comment.