Skip to content

Instantly share code, notes, and snippets.

@lisael
Created September 24, 2013 20:40
Show Gist options
  • Save lisael/6690909 to your computer and use it in GitHub Desktop.
Save lisael/6690909 to your computer and use it in GitHub Desktop.
import sys
import re
INPUT_FILE = sys.argv[1]
with open(INPUT_FILE) as inf:
origs_lines = inf.readlines()
lines = []
for line in origs_lines:
lines.append(re.sub(r'(<link.*>)(<strong>.*<\/strong>)', r'\2\1', line))
lines.reverse()
inner = []
for line in lines:
if "<header" in line:
print line
for l in inner:
print l
inner = []
elif "<strong>" in line:
inner.append(line)
for l in inner:
print l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment