Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(templates): suppress extra newlines in default changelog#954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletionsdocs/changelog_templates.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -339,8 +339,7 @@ Below is an example template that can be used to render a Changelog:
.. code-block::

# CHANGELOG
{% if context.history.unreleased | length > 0 %}

{% if context.history.unreleased | length > 0 -%}
{# UNRELEASED #}
## Unreleased
{% for type_, commits in context.history.unreleased | dictsort %}
Expand All@@ -349,12 +348,9 @@ Below is an example template that can be used to render a Changelog:
* {{ commit.commit.message.rstrip() }} ([`{{ commit.commit.hexsha[:7] }}`]({{ commit.commit.hexsha | commit_hash_url }}))
{% else %}
* {{ commit.commit.message.rstrip() }} ([`{{ commit.commit.hexsha[:7] }}`]({{ commit.commit.hexsha | commit_hash_url }}))
{% endif %}{% endfor %}{% endfor %}

{% endif %}

{% endif %}{% endfor %}{% endfor %}{% endif -%}
{# RELEASED #}
{% for version, release in context.history.released.items() %}
{% for version, release in context.history.released.items()-%}
## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{% for type_, commits in release["elements"] | dictsort %}
### {{ type_ | capitalize }}
Expand Down
6 changes: 3 additions & 3 deletionssemantic_release/data/templates/CHANGELOG.md.j2
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
# CHANGELOG
{% if context.history.unreleased | length > 0 %}
{% if context.history.unreleased | length > 0-%}
{# UNRELEASED #}
## Unreleased
{% for type_, commits in context.history.unreleased | dictsort %}
Expand All@@ -8,8 +8,8 @@
* {{ commit.message.rstrip() }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
{% else %}
* {{ commit.message.rstrip() }} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
{% endif %}{% endfor %}{% endfor %}{% endif %}
{% for version, release in context.history.released.items() %}
{% endif %}{% endfor %}{% endfor %}{% endif-%}
{% for version, release in context.history.released.items()-%}
{# RELEASED #}
## {{ version.as_semver_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{% for type_, commits in release["elements"] | dictsort %}
Expand Down
5 changes: 2 additions & 3 deletionstests/fixtures/git_repo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -332,8 +332,7 @@ def build_version_entry(version: VersionStr, version_def: RepoVersionDef) -> str
version_entry.append(f"## {version}\n")
else:
version_entry.append(
# TODO: artificial newline in front due to template when no Unreleased changes exist
f"\n## v{version} ({TODAY_DATE_STR})\n"
f"## v{version} ({TODAY_DATE_STR})\n"
)

for section_def in version_def["changelog_sections"]:
Expand All@@ -356,7 +355,7 @@ def _mimic_semantic_release_default_changelog(
version_entries.insert(0, build_version_entry(version, version_def))

changelog_content = (
str.join("\n" *3, [header, str.join("\n", list(version_entries))]).rstrip()
str.join("\n" *2, [header, str.join("\n", list(version_entries))]).rstrip()
+ "\n"
)

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp