Created
April 3, 2020 20:35
-
-
Save zimeon/670d6f55e53acd986b89accc69a42fe0 to your computer and use it in GitHub Desktop.
This file contains 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 re | |
import sys | |
e = 0 | |
w = 0 | |
def exxx(m): | |
global e | |
e += 1 | |
return '<span id="E%03d">%s</span>' % (e, m.group(1)) | |
def wxxx(m): | |
global w | |
w += 1 | |
return '<span id="W%03d">%s</span>' % (w, m.group(1)) | |
with open('index.html', 'r') as fh: | |
for line in fh: | |
line = re.sub(r'''(MUST NOT|MUST)''', exxx, line) | |
line = re.sub(r'''(SHOULD NOT|SHOULD)''', wxxx, line) | |
sys.stdout.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment