-
Notifications
You must be signed in to change notification settings - Fork 128
Easier template format #706
Copy link
Copy link
Closed
Description
(not a bug)
I wanted to wrap my head around the template and I couldn't do it without getting proper syntax highlighting and indentation so I can follow along.
It took a little while but I put this together to match the v24.8.0 template, thought i'd pass it along.
Let me know if you want a PR.
Would you be open to an examples directory to hold different usage scenarios for reference? I can put together my use case, template, and config along with a small readme.
{%- set newline = "\n" %}
{%- if render_title %}
{%- if versiondata.name %}
{{- "# " }}{{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }}){{ newline * 2 }}
{%- else %}
{{- "# " }}{{ versiondata.version }} ({{ versiondata.date }}){{ newline * 2 }}
{%- endif %}
{%- endif %}
{%- for section, _ in sections.items() %}
{%- if section %}
{{- "## " }}{{section}}{{ newline * 2 }}
{%- endif %}
{%- if sections[section] %}
{%- for category, val in definitions.items() if category in sections[section] %}
{{- "### " }}{{ definitions[category]['name'] }}
{{- newline * 2 }}
{%- for text, values in sections[section][category].items() %}
{{- "- " }}{{ text }}
{%- if values %}
{%- if "\n - " in text or '\n * ' in text %}
{{- newline * 2 }}
{{- " (" }}
{%- else %}
{%- if text %} ({% endif %}
{%- endif -%}
{%- for issue in values %}
{{- issue.split(": ", 1)[0] }}{% if not loop.last %}, {% endif %}
{%- endfor %}
{%- if text %}){% endif %}
{{- newline * 2 }}
{%- else %}
{{- newline * 2 }}
{%- endif %}
{%- endfor %}
{%- if issues_by_category[section][category] and "]: " in issues_by_category[section][category][0] %}
{%- for issue in issues_by_category[section][category] %}
{{- issue }}
{%- endfor %}
{{- newline * 2 }}
{%- endif %}
{%- if sections[section][category]|length == 0 %}
{{- "No significant changes." }}
{{- newline * 2 }}
{%- else %}
{%- endif %}
{%- endfor %}
{%- else %}
{{- "No significant changes." }}
{{- newline * 2 }}
{%- endif %}
{%- endfor %}
{#
This comment adds one more newline at the end of the rendered newsfile content.
In this way the there are 2 newlines between the latest release and the previous release content.
#}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels