Colin-b / keepachangelog

Convert keep a changelog markdown file into python dict

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`from_dict` returns 2 newlines at EOF when there's no releases with URL in metadata

rockstarr-programmerr opened this issue · comments

It's problematic when - for example - your pipeline has a pre-commit hook that checks for exactly 1 newline at EOF.

Reproduceable code:

import keepachangelog

clg_txt = """# Changelog

## [1.0.0] - 2022-10-18
### Added
- A cool feature
"""

with open('test.changelog.md', 'w') as f:
    f.write(clg_txt)

clg = keepachangelog.to_dict('./test.changelog.md')
new_clg_txt = keepachangelog.from_dict(clg)

print(new_clg_txt.endswith('\n\n'))  # True

Fixed in version 2.0.0.dev3 available on pypi. Thanks again for your contribution !