|
1 |
| -{% set underline = "=" %} |
| 1 | +{# This is a heavily customised version of towncrier's default template. #} |
2 | 2 |
|
3 |
| -{{ underline * ((top_line)|length) }} |
4 |
| -{% for section in sections %} |
5 |
| -{% set underline = "-" %} |
6 |
| -{% if section %} |
7 |
| -{{ section }} |
8 |
| -{{ underline * section|length }}{% set underline = "~" %} |
| 3 | +{#- |
| 4 | + Only render if there's any changes to show. |
9 | 5 |
|
10 |
| -{% endif %} |
11 |
| -{% if sections[section] %} |
12 |
| -{% for category, val in definitions.items() if category in sections[section] and category != 'trivial' %} |
| 6 | + This serves as a compatibility "hack" since we render unreleased news entries |
| 7 | + in our changelog with ``sphinxcontrib.towncrier``; which triggers a render even |
| 8 | + when there's no entries to be rendered. |
| 9 | +#} |
| 10 | +{% if sections[''] %} |
13 | 11 |
|
14 |
| -{{ definitions[category]['name'] }} |
15 |
| -{{ underline * definitions[category]['name']|length }} |
| 12 | +{#- Heading for individual version #} |
| 13 | +{{ versiondata.version }} ({{ versiondata.date }}) |
| 14 | +{{ top_underline * ((versiondata.version + versiondata.date)|length + 3) }} |
16 | 15 |
|
17 |
| -{% if definitions[category]['showcontent'] %} |
18 |
| -{% for text, values in sections[section][category]|dictsort(by='value') %} |
19 |
| -- {{ text }}{% if category != 'vendor' and category != 'process' %} ({{ values|sort|join(', ') }}){% endif %} |
| 16 | +{# |
20 | 17 |
|
21 |
| -{% endfor %} |
22 |
| -{% else %} |
23 |
| -- {{ sections[section][category]['']|sort|join(', ') }} |
| 18 | + The following loop will run exactly once, with ``section_name == ""``. |
24 | 19 |
|
| 20 | + This is due to the undocumented "sections" feature in towncrier. |
| 21 | + See https://github.com/twisted/towncrier/issues/61. |
25 | 22 |
|
26 |
| -{% endif %} |
27 |
| -{% if sections[section][category]|length == 0 %} |
| 23 | + We don't use this feature, and this template doesn't render the section |
| 24 | + heading for that reason. |
| 25 | +#} |
| 26 | +{% for section_name, entries_by_type in sections.items() -%} |
| 27 | +{# Only show types with entries and ``showcontent = true``, using the order from pyproject.toml #} |
| 28 | +{% for type_ in definitions if (sections[section_name][type_] and definitions[type_]['showcontent']) %} |
28 | 29 |
|
29 |
| -No significant changes. |
| 30 | +{# Heading for individual types #} |
| 31 | +{{ definitions[type_]['name'] }} |
| 32 | +{{ underlines[0] * definitions[type_]['name']|length }} |
30 | 33 |
|
31 |
| - |
32 |
| -{% else %} |
33 |
| -{% endif %} |
| 34 | +{# This is the loop that generates individual entries #} |
| 35 | +{% for message, issue_reference in sections[section_name][type_]|dictsort(by='value') %} |
| 36 | +- {{ message }} |
| 37 | + {%- if type_ not in ["vendor", "process"] %} ({{ issue_reference|sort|join(', ') }}){% endif %} |
34 | 38 | {% endfor %}
|
35 |
| -{% else %} |
36 | 39 |
|
| 40 | +{% else %} |
| 41 | +{# We only have entries where the type has ``showcontent = true``. #} |
37 | 42 | No significant changes.
|
38 | 43 |
|
39 |
| - |
40 |
| -{% endif %} |
41 |
| -{% endfor %} |
| 44 | +{% endfor -%} |
| 45 | +{% endfor -%} |
| 46 | +{% endif -%} |
0 commit comments