From e9383ad8c6f742aaa7eeaeb85e4def7109b1f6e9 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 19 Aug 2023 20:40:07 +0200 Subject: [PATCH 1/7] Move formatting into roles; add raw LaTeX nodes in roles for basic LaTeX formatting. --- .../ansible-docsite/macros/choiceslist.rst.j2 | 4 +- .../ansible-docsite/macros/parameters.rst.j2 | 18 +- .../macros/returnvalues.rst.j2 | 8 +- .../docsite/ansible-docsite/plugin.rst.j2 | 18 -- .../data/docsite/ansible-docsite/role.rst.j2 | 15 -- .../antsibull-minimal.css | 2 +- src/sphinx_antsibull_ext/antsibull.sty | 10 + src/sphinx_antsibull_ext/assets.py | 37 ++-- .../css/antsibull-minimal.scss | 52 ++--- src/sphinx_antsibull_ext/roles.py | 209 +++++++++++------- .../collections/ns/col2/bar_role.rst | 15 -- .../collections/ns/col2/foo2_module.rst | 18 -- .../collections/ns/col2/foo3_module.rst | 18 -- .../collections/ns/col2/foo4_module.rst | 18 -- .../collections/ns2/col/bar_filter.rst | 18 -- .../collections/ns2/col/bar_test.rst | 18 -- .../collections/ns2/col/foo2_module.rst | 18 -- .../collections/ns2/col/foo_become.rst | 18 -- .../collections/ns2/col/foo_cache.rst | 18 -- .../collections/ns2/col/foo_callback.rst | 18 -- .../collections/ns2/col/foo_cliconf.rst | 18 -- .../collections/ns2/col/foo_connection.rst | 18 -- .../collections/ns2/col/foo_filter.rst | 18 -- .../collections/ns2/col/foo_inventory.rst | 18 -- .../collections/ns2/col/foo_lookup.rst | 18 -- .../collections/ns2/col/foo_module.rst | 18 -- .../collections/ns2/col/foo_role.rst | 15 -- .../collections/ns2/col/foo_shell.rst | 18 -- .../collections/ns2/col/foo_strategy.rst | 18 -- .../collections/ns2/col/foo_test.rst | 18 -- .../collections/ns2/col/foo_vars.rst | 18 -- .../collections/ns2/col/sub.foo3_module.rst | 18 -- .../collections/ns2/flatcol/foo2_module.rst | 18 -- .../collections/ns2/flatcol/foo_module.rst | 18 -- .../collections/ns/col2/bar_role.rst | 15 -- .../collections/ns/col2/foo2_module.rst | 18 -- .../collections/ns/col2/foo3_module.rst | 18 -- .../collections/ns/col2/foo4_module.rst | 18 -- .../collections/ns2/col/bar_filter.rst | 18 -- .../collections/ns2/col/bar_test.rst | 18 -- .../collections/ns2/col/foo2_module.rst | 18 -- .../collections/ns2/col/foo_become.rst | 18 -- .../collections/ns2/col/foo_cache.rst | 18 -- .../collections/ns2/col/foo_callback.rst | 18 -- .../collections/ns2/col/foo_cliconf.rst | 18 -- .../collections/ns2/col/foo_connection.rst | 18 -- .../collections/ns2/col/foo_filter.rst | 18 -- .../collections/ns2/col/foo_inventory.rst | 18 -- .../collections/ns2/col/foo_lookup.rst | 18 -- .../collections/ns2/col/foo_module.rst | 18 -- .../collections/ns2/col/foo_role.rst | 15 -- .../collections/ns2/col/foo_shell.rst | 18 -- .../collections/ns2/col/foo_strategy.rst | 18 -- .../collections/ns2/col/foo_test.rst | 18 -- .../collections/ns2/col/foo_vars.rst | 18 -- .../collections/ns2/col/sub.foo3_module.rst | 18 -- .../collections/ns2/flatcol/foo2_module.rst | 18 -- .../collections/ns2/flatcol/foo_module.rst | 18 -- .../collections/ns2/col/bar_filter.rst | 18 -- .../collections/ns2/col/bar_test.rst | 18 -- .../collections/ns2/col/foo2_module.rst | 18 -- .../collections/ns2/col/foo_become.rst | 18 -- .../collections/ns2/col/foo_cache.rst | 18 -- .../collections/ns2/col/foo_callback.rst | 18 -- .../collections/ns2/col/foo_cliconf.rst | 18 -- .../collections/ns2/col/foo_connection.rst | 18 -- .../collections/ns2/col/foo_filter.rst | 18 -- .../collections/ns2/col/foo_inventory.rst | 18 -- .../collections/ns2/col/foo_lookup.rst | 18 -- .../collections/ns2/col/foo_module.rst | 18 -- .../collections/ns2/col/foo_role.rst | 15 -- .../collections/ns2/col/foo_shell.rst | 18 -- .../collections/ns2/col/foo_strategy.rst | 18 -- .../collections/ns2/col/foo_test.rst | 18 -- .../collections/ns2/col/foo_vars.rst | 18 -- .../collections/ns2/col/sub.foo3_module.rst | 18 -- .../collections/ns2/flatcol/foo2_module.rst | 18 -- .../collections/ns2/flatcol/foo_module.rst | 18 -- .../baseline-squash-hierarchy/bar_filter.rst | 18 -- .../baseline-squash-hierarchy/bar_test.rst | 18 -- .../baseline-squash-hierarchy/foo2_module.rst | 18 -- .../baseline-squash-hierarchy/foo_become.rst | 18 -- .../baseline-squash-hierarchy/foo_cache.rst | 18 -- .../foo_callback.rst | 18 -- .../baseline-squash-hierarchy/foo_cliconf.rst | 18 -- .../foo_connection.rst | 18 -- .../baseline-squash-hierarchy/foo_filter.rst | 18 -- .../foo_inventory.rst | 18 -- .../baseline-squash-hierarchy/foo_lookup.rst | 18 -- .../baseline-squash-hierarchy/foo_module.rst | 18 -- .../baseline-squash-hierarchy/foo_role.rst | 15 -- .../baseline-squash-hierarchy/foo_shell.rst | 18 -- .../foo_strategy.rst | 18 -- .../baseline-squash-hierarchy/foo_test.rst | 18 -- .../baseline-squash-hierarchy/foo_vars.rst | 18 -- .../sub.foo3_module.rst | 18 -- .../collections/ns2/col/bar_filter.rst | 28 +-- .../collections/ns2/col/bar_test.rst | 20 +- .../collections/ns2/col/foo2_module.rst | 22 +- .../collections/ns2/col/foo_become.rst | 38 +--- .../collections/ns2/col/foo_cache.rst | 20 +- .../collections/ns2/col/foo_callback.rst | 18 -- .../collections/ns2/col/foo_cliconf.rst | 18 -- .../collections/ns2/col/foo_connection.rst | 22 +- .../collections/ns2/col/foo_filter.rst | 20 +- .../collections/ns2/col/foo_inventory.rst | 18 -- .../collections/ns2/col/foo_lookup.rst | 20 +- .../collections/ns2/col/foo_module.rst | 24 +- .../collections/ns2/col/foo_role.rst | 17 +- .../collections/ns2/col/foo_shell.rst | 24 +- .../collections/ns2/col/foo_strategy.rst | 18 -- .../collections/ns2/col/foo_test.rst | 20 +- .../collections/ns2/col/foo_vars.rst | 22 +- .../collections/ns2/col/sub.foo3_module.rst | 22 +- tests/functional/build-docs-baseline.sh | 2 +- 115 files changed, 227 insertions(+), 2069 deletions(-) create mode 100644 src/sphinx_antsibull_ext/antsibull.sty diff --git a/src/antsibull_docs/data/docsite/ansible-docsite/macros/choiceslist.rst.j2 b/src/antsibull_docs/data/docsite/ansible-docsite/macros/choiceslist.rst.j2 index a1ab8ba1..6e83073e 100644 --- a/src/antsibull_docs/data/docsite/ansible-docsite/macros/choiceslist.rst.j2 +++ b/src/antsibull_docs/data/docsite/ansible-docsite/macros/choiceslist.rst.j2 @@ -35,7 +35,7 @@ {% for choice, desc in choices | dictsort %}
  • {% if not has_no_default and ((default_value is not list and default_value == choice) or (default_value is list and choice in default_value)) %} -

    @{ choice | antsibull_to_json | escape }@ (default): +

    @{ choice | antsibull_to_json | escape }@ (default): {% else %}

    @{ choice | antsibull_to_json | escape }@: {% endif %} @@ -48,7 +48,7 @@ {% else %} {% for choice in choices %} {% if not has_no_default and ((default_value is not list and default_value == choice) or (default_value is list and choice in default_value)) %} -

  • @{ choice | antsibull_to_json | escape }@ ← (default)

  • +
  • @{ choice | antsibull_to_json | escape }@ ← (default)

  • {% else %}
  • @{ choice | antsibull_to_json | escape }@

  • {% endif %} 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..12a7103b 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 @@ -204,7 +204,7 @@ {% endif %}

    {% if value['version_added'] is still_relevant(collection=value['version_added_collection'] or collection) %} -

    added in @{ version_added_html(value['version_added'], value['version_added_collection'] or collection) }@

    +

    added in @{ version_added_html(value['version_added'], value['version_added_collection'] or collection) }@

    {% endif %} {% if plugin_type != 'module' %} @{ deprecates_html(value['deprecated'], collection, role_entrypoint=role_entrypoint) }@ @@ -221,16 +221,16 @@ {% endif %} {# Show possible choices and highlight details #} {% if value['choices'] %} -

    Choices:

    +

    Choices:

    @{ choices_html(value['choices'], value['default'], role_entrypoint=role_entrypoint) }@ {% endif %} {# Show default value, when multiple choice or no choices #} {% if value['default'] is not none and value['default'] not in value['choices'] %} -

    Default: @{ value['default'] | antsibull_to_json | escape | indent(6, blank=true) }@

    +

    Default: @{ value['default'] | antsibull_to_json | escape | indent(6, blank=true) }@

    {% endif %} {# Configuration #} {% if plugin_type != 'module' and plugin_type != 'role' and (value['ini'] or value['env'] or value['vars'] or value['cli']) %} -

    Configuration:

    +

    Configuration:

    diff --git a/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_module.rst b/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_module.rst index 5cb6bde8..a5341e15 100644 --- a/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_module.rst +++ b/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_module.rst @@ -126,7 +126,7 @@ Parameters

    dictionary

    -

    added in ns2.col 2.0.0

    +

    added in ns2.col 2.0.0

    Some recursive foo.

    diff --git a/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_shell.rst b/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_shell.rst index 42549046..9503717a 100644 --- a/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_shell.rst +++ b/tests/functional/baseline-use-html-blobs/collections/ns2/col/foo_shell.rst @@ -95,7 +95,7 @@ Parameters

    string

    -

    added in ansible-base 2.10

    +

    added in ansible-base 2.10