Comments (5)
Hello Étienne,
This is a nice idea indeed I can see the appeal.
It will maybe needs some more tweaking to retrieve original formatting but we can always enhance it afterwards.
Do you want to come up with a pull request? I am under quite a bit of load for now so I may not be able to release something before August.
from keepachangelog.
Hi Colin,
No rush for it. I think it will be a really useful feature to get more adoption of your module.
For now, I have made it work on my side by updating the dict to an ordereddict and creating my own to_str function which I can share:
...
with tempfile.NamedTemporaryFile() as temp:
temp.write(changelog_file.decoded_content)
temp.flush()
changelog_content = OrderedDict(keepachangelog.to_dict(temp.name))
changelog_content[version] = {
"changed": [
comment
],
"release_date": datetime.today().strftime('%Y-%m-%d'),
"version": version,
}
changelog_content.move_to_end(version, last=False)
new_changelog = get_changelog_from_dict(changelog_content)
...
def get_changelog_from_dict(content):
changelog = """# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
"""
categories = {v: k for k, v in keepachangelog._changelog.categories.items()}
for version, log in content.items():
changelog += f"\n## [{log['version']}] - {log['release_date']}\n"
for cat in categories:
if cat in log:
changelog += f"{categories[cat]}\n"
for line in log[cat]:
changelog += f"- {line}"
changelog += '\n'
return changelog.rstrip()
Thanks again!
Etienne
from keepachangelog.
With the addition of url from #22 this feature could be implemented without loss of information.
from keepachangelog.
This feature is available on the develop branch and will be part of next release
from keepachangelog.
Release 2.0.0.dev0 is now available with this change on pypi.
from keepachangelog.
Related Issues (20)
- Allow pre-release versioning HOT 6
- Support a changelog file which doesn't use "sub sections" like "added", "changed" ... HOT 11
- A dict in python is not ordered HOT 2
- Add url to a release HOT 5
- 0.5.0 is breaking retro-compatibility HOT 1
- Add semantic version details
- Multiline entry results in multiple entries HOT 5
- Allow for using a different masthead/opening paragraph HOT 3
- "to_raw_dict" doesn't not include "Unreleased" HOT 3
- to_dict does not allow to provide a custom encoding HOT 4
- `from_dict` returns 2 newlines at EOF when there's no releases with URL in metadata HOT 1
- How can I retrieve latest version on pypi? HOT 1
- Patch version bump should be performed when the only category is fixed HOT 1
- Allow to provide a list of categories for each version bump type (major, minor, patch)
- .todict remove ** at start of a commit line HOT 1
- Text segments in versions are transformed to lowercase
- you're now a dependency! :) HOT 1
- parse category entries HOT 4
- 0.3.0: asterisks should only be stripped from the left HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keepachangelog.