Skip to content

Commit

Permalink
fix spacing errors with towncrier build by adding custom template
Browse files Browse the repository at this point in the history
  • Loading branch information
lykinsbd committed Dec 5, 2024
1 parent 0e89fb7 commit 087f82e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/+changelog_edits.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Editing old `CHANGELOG.md` entries to use uniform formatting from new Towncrier template.
1 change: 1 addition & 0 deletions changelog/+towncrier_template.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added custom Towncrier template to remove extra space after new Changelog entries.
53 changes: 53 additions & 0 deletions changelog/towncrier.md.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{% if render_title %}
{% if versiondata.name %}
# {{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }})
{% else %}
# {{ versiondata.version }} ({{ versiondata.date }})
{% endif %}
{% endif %}
{% for section, _ in sections.items() %}
{% if section %}

## {{section}}
{% endif %}
{% if sections[section] %}
{% for category, val in definitions.items() if category in sections[section] %}
### {{ definitions[category]['name'] }}

{% for text, values in sections[section][category].items() %}
- {{ text }}
{%- if values %}
{% if "\n - " in text or '\n * ' in text %}


(
{%- else %}
{% if text %} ({% endif %}
{%- endif -%}
{%- for issue in values %}
{{ issue.split(": ", 1)[0] }}{% if not loop.last %}, {% endif %}
{%- endfor %}
{% if text %}){% endif %}

{% else %}

{% 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 %}

{% endif %}
{% if sections[section][category]|length == 0 %}
No significant changes.

{% else %}
{% endif %}
{% endfor %}
{% else %}
No significant changes.

{% endif %}
{% endfor +%}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ underlines = ["", "", ""]
title_format = "## [Infrahub - v{version}](https://github.com/opsmill/infrahub/tree/infrahub-v{version}) - {project_date}"
issue_format = "[#{issue}](https://github.com/opsmill/infrahub/issues/{issue})"
orphan_prefix = "+"
template = "changelog/towncrier.md.template"

[[tool.towncrier.type]]
directory = "security"
Expand Down

0 comments on commit 087f82e

Please sign in to comment.