diff --git a/changelogs/fragments/6-tests-filters.yml b/changelogs/fragments/6-tests-filters.yml new file mode 100644 index 00000000..58344fa2 --- /dev/null +++ b/changelogs/fragments/6-tests-filters.yml @@ -0,0 +1,6 @@ +minor_changes: + - "Support test and filter plugins when ansible-core 2.14+ is used. This works with the current ``devel`` branch of ansible-core (https://github.com/ansible-community/antsibull-docs/pull/6)." + - "Support parameter type ``any``, and show ``raw`` as ``any`` (https://github.com/ansible-community/antsibull-docs/pull/6)." + - "More robust handling of parsing errors when ansible-doc was unable to extract documentation (https://github.com/ansible-community/antsibull-docs/pull/6)." + - "If lookup plugins have an option called ``_terms``, it is now shown in its own section ``Terms``, and not in the regular ``Parameters`` section (https://github.com/ansible-community/antsibull-docs/pull/6)." + - "If lookup plugins have a single return value starting with ``_``, that return value is now labelled ``Return value`` (https://github.com/ansible-community/antsibull-docs/pull/6)." diff --git a/src/antsibull_docs/cli/doc_commands/stable.py b/src/antsibull_docs/cli/doc_commands/stable.py index 65a50bb4..50f29483 100644 --- a/src/antsibull_docs/cli/doc_commands/stable.py +++ b/src/antsibull_docs/cli/doc_commands/stable.py @@ -136,6 +136,9 @@ def normalize_plugin_info(plugin_type: str, # If you wonder why this code isn't showing up in code coverage: that's because it's executed # in a subprocess. See normalize_all_plugin_info below. + if 'error' in plugin_info: + return ({}, [plugin_info['error']]) + errors = [] if plugin_type == 'role': try: @@ -251,10 +254,12 @@ def get_plugin_contents(plugin_info: t.Mapping[str, t.Mapping[str, t.Any]], namespace, collection, short_name = get_fqcn_parts(plugin_name) if plugin_type == 'role': desc = '' - if 'main' in plugin_desc['entry_points']: - desc = plugin_desc['entry_points']['main']['short_description'] + if 'entry_points' in plugin_desc and 'main' in plugin_desc['entry_points']: + desc = plugin_desc['entry_points']['main'].get('short_description') or '' + elif 'doc' in plugin_desc: + desc = plugin_desc['doc'].get('short_description') or '' else: - desc = plugin_desc['doc']['short_description'] + desc = '' plugin_contents[plugin_type]['.'.join((namespace, collection))][short_name] = desc return plugin_contents diff --git a/src/antsibull_docs/constants.py b/src/antsibull_docs/constants.py index 2e99f894..8cf0c433 100644 --- a/src/antsibull_docs/constants.py +++ b/src/antsibull_docs/constants.py @@ -16,9 +16,11 @@ DOCUMENTABLE_PLUGINS: FrozenSet[str] = frozenset(('become', 'cache', 'callback', 'cliconf', 'connection', 'httpapi', 'inventory', 'lookup', 'netconf', 'shell', 'vars', 'module', - 'strategy', 'role',)) + 'strategy', 'role', 'filter', 'test')) DOCUMENTABLE_PLUGINS_MIN_VERSION: Dict[str, str] = { + 'filter': '2.14.0', 'role': '2.11.0', + 'test': '2.14.0', } diff --git a/src/antsibull_docs/data/docsite/macros/parameters.rst.j2 b/src/antsibull_docs/data/docsite/macros/parameters.rst.j2 index c46252c1..ec4398cf 100644 --- a/src/antsibull_docs/data/docsite/macros/parameters.rst.j2 +++ b/src/antsibull_docs/data/docsite/macros/parameters.rst.j2 @@ -11,7 +11,7 @@ * - Parameter - Comments -{% for key, value in elements | dictsort recursive %} +{% for key, value in elements recursive %} {# parameter name with required and/or introduced label #} * - .. raw:: html @@ -186,7 +186,7 @@
{% set row_class = cycler('even', 'odd') %} -{% for key, value in elements | dictsort recursive %} +{% for key, value in elements recursive %} {# parameter name with required and/or introduced label #}