replace startswith with re.match in finding lines that begin with macros
This will help later in searching the string created by re.match.
This commit is contained in:
parent
f2391f0966
commit
195399bcb2
1 changed files with 5 additions and 2 deletions
|
@ -1435,11 +1435,14 @@ def global_sanity_check(filename, lines):
|
|||
except KeyError:
|
||||
print >>sys.stderr, '%s, line %s: magic comment "unwho %s" does not match any current keys: %s' \
|
||||
% (filename, i+1, unmac, str(whopairs.keys())[1:-1])
|
||||
if lines[i].lstrip().startswith('{'):
|
||||
# Parse recruit/recall macros to recognize characters. This section
|
||||
# assumes that such a macro is the first item on a line.
|
||||
leadmac = re.match(r'{[^}\s]+.', lines[i].lstrip())
|
||||
if leadmac:
|
||||
# Recognize macro pairings from "wmllint: who" magic
|
||||
# comments.
|
||||
for mac in whopairs.keys():
|
||||
if mac in lines[i]:
|
||||
if mac in leadmac.group(0):
|
||||
for who in whopairs[mac].split(","):
|
||||
if who.strip().startswith("--"):
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue