remove unnecessary newlines in templates (#537)

This commit is contained in:
Robert Kaussow 2023-08-09 09:46:15 +02:00 committed by GitHub
parent aa29881542
commit a4a497ca4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 18 additions and 18 deletions

View File

@ -75,6 +75,8 @@ class Parser:
) )
def _parse_meta_file(self): def _parse_meta_file(self):
self._data["meta"]["name"] = {"value": self.config.config["role_name"]}
for rfile in self._files_registry.get_files(): for rfile in self._files_registry.get_files():
if any("meta/main." + ext in rfile for ext in YAML_EXTENSIONS): if any("meta/main." + ext in rfile for ext in YAML_EXTENSIONS):
with open(rfile, encoding="utf8") as yaml_file: with open(rfile, encoding="utf8") as yaml_file:
@ -91,8 +93,6 @@ class Parser:
self._data["meta"]["dependencies"] = { self._data["meta"]["dependencies"] = {
"value": data.get("dependencies") "value": data.get("dependencies")
} }
self._data["meta"]["name"] = {"value": self.config.config["role_name"]}
except ( except (
ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError
) as e: ) as e:

View File

@ -1,4 +1,3 @@
## Requirements ## Requirements
{% if meta | deep_get(meta, "min_ansible_version.value") %} {% if meta | deep_get(meta, "min_ansible_version.value") %}

View File

@ -1,6 +1,5 @@
{% set var = role.var | default({}) %} {% set var = role.var | default({}) %}
{% if var %} {% if var %}
## Default Variables ## Default Variables
{% for key, item in var | dictsort %} {% for key, item in var | dictsort %}
@ -15,7 +14,6 @@
{% if item.deprecated is defined %} {% if item.deprecated is defined %}
{% set deprecated = [item.deprecated] if item.deprecated is string else item.deprecated %} {% set deprecated = [item.deprecated] if item.deprecated is string else item.deprecated %}
{% set deprecated_string = deprecated | map("replace", "\n\n", "\n") | safe_join("\n") %} {% set deprecated_string = deprecated | map("replace", "\n\n", "\n") | safe_join("\n") %}
{% if deprecated_string %} {% if deprecated_string %}
**_Deprecated:_** {{ deprecated_string }}<br /> **_Deprecated:_** {{ deprecated_string }}<br />
{% else %} {% else %}

View File

@ -17,7 +17,7 @@ summary: {{ meta.summary.value | safe_join(" ") }}
<!--more--> <!--more-->
{# TOC #} {# TOC #}
{% include '_toc.j2' %} {% include '_toc.j2' +%}
{# Requirements #} {# Requirements #}
{% include '_requirements.j2' %} {% include '_requirements.j2' %}

View File

@ -9,7 +9,7 @@
{% endif %} {% endif %}
{# TOC #} {# TOC #}
{% include '_toc.j2' %} {% include '_toc.j2' +%}
{# Requirements #} {# Requirements #}
{% include '_requirements.j2' %} {% include '_requirements.j2' %}

View File

@ -1,4 +1,3 @@
## Requirements ## Requirements
{% if meta | deep_get(meta, "min_ansible_version.value") %} {% if meta | deep_get(meta, "min_ansible_version.value") %}

View File

@ -1,6 +1,5 @@
{% set var = role.var | default({}) %} {% set var = role.var | default({}) %}
{% if var %} {% if var %}
## Default Variables ## Default Variables
{% for key, item in var | dictsort %} {% for key, item in var | dictsort %}
@ -15,7 +14,6 @@
{% if item.deprecated is defined %} {% if item.deprecated is defined %}
{% set deprecated = [item.deprecated] if item.deprecated is string else item.deprecated %} {% set deprecated = [item.deprecated] if item.deprecated is string else item.deprecated %}
{% set deprecated_string = deprecated | map("replace", "\n\n", "\n") | safe_join("\n") %} {% set deprecated_string = deprecated | map("replace", "\n\n", "\n") | safe_join("\n") %}
{% if deprecated_string %} {% if deprecated_string %}
**_Deprecated:_** {{ deprecated_string }}<br /> **_Deprecated:_** {{ deprecated_string }}<br />
{% else %} {% else %}

View File

@ -31,14 +31,12 @@ the default description with an annotation.
## Requirements ## Requirements
- Minimum Ansible version: `2.4` - Minimum Ansible version: `2.10`
## Default Variables ## Default Variables
### demo_role_deprecated ### demo_role_deprecated
**_Deprecated_**<br /> **_Deprecated_**<br />
#### Default value #### Default value
@ -49,7 +47,6 @@ demo_role_deprecated: b
### demo_role_deprecated_info ### demo_role_deprecated_info
**_Deprecated:_** This variable is deprected since `v2.0.0` and will be removed in a future release.<br /> **_Deprecated:_** This variable is deprected since `v2.0.0` and will be removed in a future release.<br />
**_Type:_** string<br /> **_Type:_** string<br />

View File

@ -8,14 +8,16 @@ galaxy_info:
description: Role to demonstrate ansible-doctor. description: Role to demonstrate ansible-doctor.
author: John Doe author: John Doe
license: MIT license: MIT
min_ansible_version: 2.4 min_ansible_version: "2.10"
platforms: platforms:
- name: EL - name: EL
versions: versions:
- 7 - "9"
galaxy_tags: galaxy_tags:
- demo - demo
- documentation - documentation
dependencies: dependencies:
- role1 - role1
- role: role2 - role: role2
- name: namespace.role3

View File

@ -7,6 +7,7 @@ Role to demonstrate ansible-doctor.
## Table of content ## Table of content
- [Requirements](#requirements)
- [Default Variables](#default-variables) - [Default Variables](#default-variables)
- [demo_role_unset](#demo_role_unset) - [demo_role_unset](#demo_role_unset)
- [Discovered Tags](#discovered-tags) - [Discovered Tags](#discovered-tags)
@ -17,6 +18,10 @@ Role to demonstrate ansible-doctor.
--- ---
## Requirements
- Minimum Ansible version: `2.10`
## Default Variables ## Default Variables
### demo_role_unset ### demo_role_unset

View File

@ -4,14 +4,16 @@ galaxy_info:
description: Role to demonstrate ansible-doctor. description: Role to demonstrate ansible-doctor.
author: John Doe author: John Doe
license: MIT license: MIT
min_ansible_version: 2.4 min_ansible_version: "2.10"
platforms: platforms:
- name: EL - name: EL
versions: versions:
- 7 - "9"
galaxy_tags: galaxy_tags:
- demo - demo
- documentation - documentation
dependencies: dependencies:
- role1 - role1
- role: role2 - role: role2
- name: namespace.role3