Skip to content

Commit f480c81

Browse files
committed
fix generate_text.py to work with python3
1 parent d4ea506 commit f480c81

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tool/generate_text.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
if len(magicks) > 1:
1313
print("ERROR: Multiple files match %s" % globspec)
1414
for m in magicks:
15-
print m
15+
print(m)
1616
sys.exit(1)
1717
CONVERT_CMD = magicks[0]
1818

19-
TEXT_RE = re.compile("(?P<quote>['\"])TEX:([^(?P=quote)]+)(?P=quote)");
19+
# find strings that look like "TEX:abc" or 'TEX:abc' (note different quote types
20+
# use <quote> to store the type of quote
21+
# use the negative-lookahead regex ((?!(?P=quote)).) to match non-quote characters
22+
TEXT_RE = re.compile("(?P<quote>['\"])TEX:(((?!(?P=quote)).)+)(?P=quote)")
2023

2124
if len(sys.argv) <= 2:
2225
print("Usage: generate_text <outputdir> <basedir1> <basedir2> ...")

0 commit comments

Comments
 (0)