From 9df11d6873dd4809fee5c58099449f9c79d32027 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 20 May 2021 16:41:21 +0200 Subject: [PATCH] Configure towncrier tool --- tools/towncrier/template.md | 47 +++++++++++++++++++++++++++++++++++++ towncrier.toml | 7 ++++++ 2 files changed, 54 insertions(+) create mode 100644 tools/towncrier/template.md create mode 100644 towncrier.toml diff --git a/tools/towncrier/template.md b/tools/towncrier/template.md new file mode 100644 index 0000000000..fd160682b5 --- /dev/null +++ b/tools/towncrier/template.md @@ -0,0 +1,47 @@ +{% if top_line %} +{{ top_line }} +{{ top_underline * ((top_line)|length)}} +{% elif versiondata.name %} +{{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }}) +{{ top_underline * ((versiondata.name + versiondata.version + versiondata.date)|length + 4)}} +{% else %} +{{ versiondata.version }} ({{ versiondata.date }}) +{{ top_underline * ((versiondata.version + versiondata.date)|length + 3)}} +{% 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]%} +{% if definitions[category]['name'] == "Features" %} +Features ✨: +{% elif definitions[category]['name'] == "Bugfixes" %} +Bugfixes 🐛: +{% elif definitions[category]['name'] == "Deprecations and Removals" %} +SDK API changes ⚠️: +{% elif definitions[category]['name'] == "Improved Documentation" %} +Improved Documentation 📚: +{% elif definitions[category]['name'] == "Misc" %} +Other changes: +{% else %} +{{ definitions[category]['name'] }} +{% endif %} +{% if definitions[category]['showcontent'] %} +{% for text, values in sections[section][category].items() %} + - {{ text }} ({{ values|join(', ') }}) +{% endfor %} +{% else %} + - {{ sections[section][category]['']|join(', ') }} +{% endif %} +{% if sections[section][category]|length == 0 %} +No significant changes. +{% else %} +{% endif %} + +{% endfor %} +{% else %} +No significant changes. +{% endif %} +{% endfor %} diff --git a/towncrier.toml b/towncrier.toml new file mode 100644 index 0000000000..09a927b77f --- /dev/null +++ b/towncrier.toml @@ -0,0 +1,7 @@ +[tool.towncrier] +directory = "newsfragment" +filename = "CHANGES.md" +name = "Changes in Element" +# Note: there is a bug, if I use title_format, the title is printed twice +# title_format = "Changes in Element {version} ({project_date})" +template="tools/towncrier/template.md"