Skip to content

Commit

Permalink
Use r-strings
Browse files Browse the repository at this point in the history
And run black to keep things tidy

Closes #284.
  • Loading branch information
martinthomson committed Nov 25, 2024
1 parent 684fd00 commit a793fc2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mk-appendix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
IN_APPENDIX = None
CURRENT = ""


def print_syntax(val):
vl = val.split("\n")
last_empty = False
Expand All @@ -24,24 +25,24 @@ def print_syntax(val):

for l in sys.stdin:
if not IN_APPENDIX:
m = re.match('%%% (.*)$', l)
m = re.match(r"%%% (.*)$", l)
if m is not None:
IN_APPENDIX = m.group(1)
else:
m = re.match('%%(#+|!) (.*)$', l)
m = re.match(r"%%(#+|!) (.*)$", l)
if m is not None:
if m.group(1) != '!':
if m.group(1) != "!":
print("%s %s" % (m.group(1), m.group(2)))
print_syntax(APPENDICES[m.group(2)])
del APPENDICES[m.group(2)]
print()
else:
print(l, end='')
print(l, end="")
else:
# Strip out everything marked as RESERVED
if l.find("RESERVED") == -1:
print(l, end='')
m = re.match("\S", l)
print(l, end="")
m = re.match(r"\S", l)
if m is None:
CURRENT += l
else:
Expand Down

0 comments on commit a793fc2

Please sign in to comment.