Skip to content

Instantly share code, notes, and snippets.

@stephen-bunn
Created April 25, 2019 16:12
Show Gist options
  • Save stephen-bunn/9be6f7360d92d8f037a103f61280d1e2 to your computer and use it in GitHub Desktop.
Save stephen-bunn/9be6f7360d92d8f037a103f61280d1e2 to your computer and use it in GitHub Desktop.
Medium - Towncrier CHANGELOG jinja2 template
{% for section in sections %}
{% set underline = "-" %}
{% if section %}
{{ section }}
{{ underline * section|length }}{% set underline = "~" %}
{% endif %}
{% if sections[section] %}
{% for category, value in definitions.items() if category in sections[section] and category != 'trivial' %}
{{ definitions[category]['name'] }}
{{ underline * definitions[category]['name']|length }}
{% if definitions[category]['showcontent'] %}
{% for text, values in sections[section][category]|dictsort(by='value') %}
- {{ text }} {% if category not in ['process', 'misc', 'doc'] %}{{ values|sort|join(',\n ') }}{% endif %}
{% endfor %}
{% else %}
- {{ sections[section][category]['']|sort|join(', ') }}
{% endif %}
{% if sections[section][category]|length == 0 %}
No significant changes.
{% else %}
{% endif %}
{% endfor %}
{% else %}
No significant changes.
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment