Last active
March 15, 2016 16:40
-
-
Save fblundun/819b233f91db66f0af8d to your computer and use it in GitHub Desktop.
Converting the snowplow/snowplow CHANGELOG to release notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example usage:
< CHANGELOG ./doit.py