Git Product home page Git Product logo

Comments (5)

Colin-b avatar Colin-b commented on July 17, 2024

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.

sharpyy avatar sharpyy commented on July 17, 2024

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.

Colin-b avatar Colin-b commented on July 17, 2024

With the addition of url from #22 this feature could be implemented without loss of information.

from keepachangelog.

Colin-b avatar Colin-b commented on July 17, 2024

This feature is available on the develop branch and will be part of next release

from keepachangelog.

Colin-b avatar Colin-b commented on July 17, 2024

Release 2.0.0.dev0 is now available with this change on pypi.

from keepachangelog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.