User:CommanderC/changelog-fix.py
< User:CommanderC
Revision as of 17:10, 19 July 2014 by CommanderC (talk | contribs) (Created page with "<pre> <nowiki> #!/usr/bin/python # cat dcss-changelog.txt | changelog-fix.py > wiki-changelog.txt import sys import re if __name__ == '__main__': data = sys.stdin.read() ...")
#!/usr/bin/python # cat dcss-changelog.txt | changelog-fix.py > wiki-changelog.txt import sys import re if __name__ == '__main__': data = sys.stdin.read() while True: m = re.search(r'^( +)-', data, flags=re.M) if not m: break data = data[:m.start()] + '*'*(len(m.group(1))//2) + '*' + data[m.end():] data = re.sub(r'\n +', r' ', data, flags=re.M) print(data, end='')