Skip to content

Instantly share code, notes, and snippets.

@fblundun
Last active March 15, 2016 16:40
Show Gist options
  • Save fblundun/819b233f91db66f0af8d to your computer and use it in GitHub Desktop.
Save fblundun/819b233f91db66f0af8d to your computer and use it in GitHub Desktop.
Converting the snowplow/snowplow CHANGELOG to release notes
#!/usr/bin/env python
import fileinput
import sys
import re
domain = None
ignored_lines = 0
for line in fileinput.input():
if line == "\n":
break
if ignored_lines < 2:
ignored_lines += 1
continue
new_domain, contents = line.split(": ", 1)
if new_domain != domain:
sys.stdout.write("\n### " + new_domain + "\n\n")
domain = new_domain
contents_chars = list(contents)
contents_chars[0] = contents_chars[0].capitalize()
sys.stdout.write("* " + "".join(contents_chars))
@fblundun
Copy link
Author

Example usage:

< CHANGELOG ./doit.py

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