{# ---MACROS AND CODE START #}
{% macro print_commit(change) %}{# MACRO needs to be all on one line #}
{% if change.scope %}- **{{ change.scope }}**: {{ change.message }} {% if config.changelog_show_authors %} *({{ change.author }})*{% endif %}{% if config.changelog_show_commits %} *({{ change.sha1[:7] }})*{% endif %}{% else %}{% if change.message %}- {{ change.message }} {% if config.changelog_show_authors %} *({{ change.author }})*{% endif %}{% if config.changelog_show_commits %} *({{ change.sha1[:7] }})*{% endif %}{% endif %}{% endif %}
{% endmacro %}{# MACRO needs to be all on one line #}
{#    MACROS AND CODE END--- #}

{# ---BODY START #}
{% for entry in tree %}{# ---BLOCK release version #}
{% if not (entry.version == 'Unreleased' and not config.changelog_unreleased) %}
## {{ entry.version }}{% if entry.date %} ({{ entry.date }}){% endif %}

{% for change_key, changes in entry.changes.items() %}{# ---BLOCK sections #}

{% if change_key %}{# ---BLOCK section header #}
### {{ change_key }}
{% endif %}{# BLOCK section header--- #}

{% for change in changes %}{# ---BLOCK commit record #}
{{ print_commit(change) }}
{% endfor %}{# BLOCK commit record--- #}
{% endfor %}{# BLOCK sections--- #}

{# keep empty line above this comment #}
{% if config.changelog_section_line %}{# ---SECTION LINE START #}
---
{% endif %}{#    SECTION LINE  END--- #}

{% endif %}
{# keep empty line above this comment #}
{% endfor %}{# BLOCK release vesion--- #}
{#    BODY END--- #}
