Skip to content

Commit

Permalink
Fix towncrier template
Browse files Browse the repository at this point in the history
Signed-off-by: Aurélien Bompard <[email protected]>
  • Loading branch information
abompard committed Jun 12, 2024
1 parent 2f8947c commit d5cd5ac
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion datanommer.commands/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ title_format = "v{version}"
issue_format = "{issue}"
template = "../tools/towncrier/template.rst.j2"
underlines = "=^-"
wrap = true
wrap = false
all_bullets = true

[[tool.towncrier.type]]
Expand Down
2 changes: 1 addition & 1 deletion datanommer.consumer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ title_format = "v{version}"
issue_format = "{issue}"
template = "../tools/towncrier/template.rst.j2"
underlines = "=^-"
wrap = true
wrap = false
all_bullets = true

[[tool.towncrier.type]]
Expand Down
2 changes: 1 addition & 1 deletion datanommer.models/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ title_format = "v{version}"
issue_format = "{issue}"
template = "../tools/towncrier/template.rst.j2"
underlines = "=^-"
wrap = true
wrap = false
all_bullets = true

[[tool.towncrier.type]]
Expand Down
68 changes: 41 additions & 27 deletions tools/towncrier/template.rst.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,68 @@
{%- endif -%}
{%- endmacro -%}

{{ top_line }}
{{ top_underline * ((top_line)|length)-}}
{{- top_line }}
{{ top_underline * ((top_line)|length) -}}

Released on {{ versiondata.date }}.
{% for section, _ in sections.items() %}
{% set underline = underlines[0] %}{% if section %}{{section}}
{{ underline * section|length }}{% set underline = underlines[1] %}

{% endif %}
{% for section, _ in sections.items() -%}
{%- set underline = underlines[0] -%}
{%- if section -%}
{{section}}
{{ underline * section|length }}
{%- set underline = underlines[1] -%}
{%- endif -%}

{% if sections[section] %}
{% for category, val in definitions.items() if category in sections[section] and category != "author" %}
{%- if sections[section] -%}
{%- for category, val in definitions.items() if category in sections[section] and category != "author" -%}
{{ definitions[category]['name'] }}
{{ underline * definitions[category]['name']|length }}

{% if definitions[category]['showcontent'] %}
{% for text, values in sections[section][category].items() %}
* {{ text }} ({% for value in values -%}
{{ reference(value) }}
{%- if not loop.last %}, {% endif -%}
{%- endfor %}).
{% endfor %}
{% if definitions[category]['showcontent'] -%}
{%- for text, values in sections[section][category].items() %}
* {{ text }}
{%- if values %}
{% if "\n - " in text or '\n * ' in text %}


(
{%- else %}
(
{%- endif -%}
{%- for issue in values %}
{{ reference(issue) }}{% if not loop.last %}, {% endif %}
{%- endfor %}
)
{% else %}
* {{ sections[section][category]['']|sort|join(', ') }}

{% endif %}
{% if sections[section][category]|length == 0 %}
{% endfor -%}
{%- else -%}
* {{ sections[section][category]['']|sort|join(', ') }}

{% endif -%}
{%- if sections[section][category]|length == 0 %}
No significant changes.

{% else %}
{% endif %}
{% else -%}
{%- endif %}

{% endfor %}
{% if sections[section]["author"] %}
{% endfor -%}
{% if sections[section]["author"] -%}
{{definitions['author']["name"]}}
{{ underline * definitions['author']['name']|length }}

Many thanks to the contributors of bug reports, pull requests, and pull request
reviews for this release:

{% for text, values in sections[section]["author"].items() %}
{% for text, values in sections[section]["author"].items() -%}
* {{ text }}
{% endfor %}
{% endif %}
{% endfor -%}
{%- endif %}

{% else %}
{% else -%}
No significant changes.


{% endif %}
{% endfor %}
{%- endfor +%}

0 comments on commit d5cd5ac

Please sign in to comment.