Skip to content

More compliant Keep a Changelog parser#170

Draft
colincasey wants to merge 3 commits into
mainfrom
better_changelog_parsing
Draft

More compliant Keep a Changelog parser#170
colincasey wants to merge 3 commits into
mainfrom
better_changelog_parsing

Conversation

@colincasey

Copy link
Copy Markdown
Contributor

This is still a work-in-progress but it's my first pass at addressing #153 with an alternative parser that is more compliant with the documented format.

It takes in the content of a changelog that should be in a flattened structure like the following:

# Changelog            → (Changelog)
                       → -
## Unreleased          → (ReleaseEntry::Unreleased)
                       → (ReleaseContents)
## [x.y.z] yyyy-mm-dd  → (ReleaseEntry::Versioned)
                       → (ReleaseContents)
### Changed            → (ChangeGroup)
                       → (List)
- foo                  → (List Item)
- bar                  → (List Item)
                       → -
### Removed            → (ChangeGroup)
                       → (List)
- baz                  → (List Item)

And convert that into the following structure:

Changelog {
  unreleased: None,
  releases: [
    ReleaseEntry {
      version: x.y.z,
      date: yyyy-mm-dd,
      tag: None,
      contents: ReleaseContents {
        "Changed": ["foo", "bar"],
        "Removed": ["baz"]
      }
    }
  ]
}

@joshwlewis

Copy link
Copy Markdown
Contributor

This is very cool. I'd love to use it on github.com/heroku/buildpacks-nodejs when generating changelog entries for automatic inventory updates!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants