From 8b5faddaddeb33c9f14b7a53d4ec071d3d3c1056 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Fri, 4 Oct 2024 08:01:58 +0200 Subject: [PATCH] feat(template): add description to markdown template --- aar_doc/templates/markdown.j2 | 10 ++++++++++ tests/fixtures/roles/extended/README.md | 6 ++++++ tests/fixtures/roles/meta_main_yaml/README.md | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/aar_doc/templates/markdown.j2 b/aar_doc/templates/markdown.j2 index ef530cf..7401e7e 100644 --- a/aar_doc/templates/markdown.j2 +++ b/aar_doc/templates/markdown.j2 @@ -24,6 +24,16 @@ Tags: {{ metadata.galaxy_info.galaxy_tags | join(', ') }} {{ argument_specs[entrypoint].short_description }} +{% if "description" in argument_specs[entrypoint] %} +{%- if argument_specs[entrypoint].description is string -%} +{{ argument_specs[entrypoint].description }} +{% else %} +{%- for line in argument_specs[entrypoint].description -%} +{{ line }} +{% endfor -%} +{% endif -%} +{% endif -%} + {% if entrypoint_options[entrypoint] %} {%- set path, options=entrypoint_options[entrypoint][0] -%} |Option|Description|Type|Required|Default| diff --git a/tests/fixtures/roles/extended/README.md b/tests/fixtures/roles/extended/README.md index fcf10be..8016073 100644 --- a/tests/fixtures/roles/extended/README.md +++ b/tests/fixtures/roles/extended/README.md @@ -20,6 +20,12 @@ Tags: ansible, docs The main entrypoint for the extended role +A longer description of the entrypoint. + +Reaching multiple lines. + +This contains the various parameters one can give in argument_specs that do not get tested below. + |Option|Description|Type|Required|Default| |---|---|---|---|---| | name | This one contains option-name, which should override the name given for the option. | str | no | | diff --git a/tests/fixtures/roles/meta_main_yaml/README.md b/tests/fixtures/roles/meta_main_yaml/README.md index 76552ba..908d3bd 100644 --- a/tests/fixtures/roles/meta_main_yaml/README.md +++ b/tests/fixtures/roles/meta_main_yaml/README.md @@ -17,6 +17,12 @@ Test role with a minimum amount of metadata The main entrypoint for the extended role +A longer description of the entrypoint. + +Reaching multiple lines. + +This contains the various parameters one can give in argument_specs that do not get tested below. + |Option|Description|Type|Required|Default| |---|---|---|---|---| | name | This one contains option-name, which should override the name given for the option. | str | no | |