diff --git a/.pre-commit-hooks/check-changelog-entries.py b/.pre-commit-hooks/check-changelog-entries.py index 84cdb461..9b2ced7b 100755 --- a/.pre-commit-hooks/check-changelog-entries.py +++ b/.pre-commit-hooks/check-changelog-entries.py @@ -17,7 +17,8 @@ "doc", "trivial", ) -CHANGELOG_ENTRY_RE = re.compile(r"[\d]+\.({})\.rst?$".format("|".join(CHANGELOG_EXTENSIONS))) +CHANGELOG_ENTRY_REREX = r"^[\d]+\.({})\.rst$".format("|".join(CHANGELOG_EXTENSIONS)) +CHANGELOG_ENTRY_RE = re.compile(CHANGELOG_ENTRY_REREX) def check_changelog_entries(files): diff --git a/changelog/70.breaking.rst b/changelog/70.breaking.rst index e4d406fe..e36de778 100644 --- a/changelog/70.breaking.rst +++ b/changelog/70.breaking.rst @@ -1 +1 @@ -Rename the ``SaltMaster.get_salt_cli`` to ``SaltMaster.salt_cli``, forgotten on `#50 `_ +Rename the ``SaltMaster.get_salt_cli`` to ``SaltMaster.salt_cli``, forgotten on `PR #50 `_ diff --git a/changelog/_template.rst b/changelog/_template.rst index 226dd47b..d466386e 100644 --- a/changelog/_template.rst +++ b/changelog/_template.rst @@ -1,38 +1,46 @@ -{% for section in sections %} -{% set underline = "-" %} -{% if section %} -{{section}} -{{ underline * section|length }}{% set underline = "~" %} +{%- macro issue_link(value) -%} +`{{ value }} `_ +{%- endmacro %} + +{% 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 sections[section] %} +{% for category, val in definitions.items() if category in sections[section]%} {{ definitions[category]['name'] }} {{ underline * definitions[category]['name']|length }} {% if definitions[category]['showcontent'] %} -{% for text, values in sections[section][category]|dictsort(by='value') %} -{% set issue_joiner = joiner(', ') %} -- {% for value in values|sort %}{{ issue_joiner() }}`{{ value }} `_{% endfor %}: {{ text }} - - +{% for text, values in sections[section][category].items() %} +{% set issue_joiner = joiner(', ') -%} +- {% for value in values|sort %}{{ issue_joiner() }}{{ issue_link(value) }}{% endfor %}: {{ text }} {% endfor %} -{% else %} -- {{ sections[section][category]['']|sort|join(', ') }} +{% else %} +- {{ sections[section][category]['']|join(', ') }} {% endif %} {% if sections[section][category]|length == 0 %} - No significant changes. - {% else %} {% endif %} + {% endfor %} {% else %} - No significant changes. diff --git a/noxfile.py b/noxfile.py index f76d7aa2..ad82a03b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -417,9 +417,9 @@ def changelog(session, draft): "--version", silent=True, log=False, - ) + ).strip() - town_cmd = ["towncrier", "--version={}".format(version)] + town_cmd = ["towncrier", "build", "--version={}".format(version)] if draft: town_cmd.append("--draft") session.run(*town_cmd) diff --git a/requirements/changelog.txt b/requirements/changelog.txt index 0d2d2d7d..6a347919 100644 --- a/requirements/changelog.txt +++ b/requirements/changelog.txt @@ -1 +1 @@ -towncrier +towncrier==21.3.0 diff --git a/requirements/docs.txt b/requirements/docs.txt index 3b476e26..c18390cd 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,9 +1,9 @@ -r base.txt -r tests.txt +-r changelog.txt furo sphinx sphinx-copybutton sphinx-prompt sphinxcontrib-spelling -sphinxcontrib-towncrier -towncrier >= 0.2.0a0 +sphinxcontrib-towncrier >= 0.2.0a0