wmllint: change "usage of" magic comment to re.search
There seems no particular reason to require that this magic comment be at the very beginning of the line, so why not switch from re.match to re.search. Also, update comments to reflect the fact that UtBS no longer uses this magic comment. A suggestion has been made to get rid of this magic comment now that UtBS is no longer using it, but it may still be in use in some UMC somewhere.
This commit is contained in:
parent
0aebc80e5e
commit
2740384796
1 changed files with 4 additions and 3 deletions
|
@ -100,7 +100,8 @@
|
|||
# wmllint: usage of <unit> is <class>
|
||||
# Note that <unit> must be a string wrapped in ASCII doublequotes. This
|
||||
# declaration will be useful if you are declaring units with macros that
|
||||
# include a substitutable formal in the unit name; there are examples in UtBS.
|
||||
# include a substitutable formal in the unit name; there were examples in
|
||||
# UtBS, but they have since been converted to use the [base_unit] tag.
|
||||
#
|
||||
# If a mismatch between a recruit list and recruitment pattern involves a
|
||||
# usage type outside the five core types, the warning message will include a
|
||||
|
@ -1321,10 +1322,10 @@ def global_sanity_check(filename, lines):
|
|||
# Interpret various magic comments
|
||||
for i in xrange(len(lines)):
|
||||
# Interpret magic comments for setting the usage pattern of units.
|
||||
# This copes with some wacky UtBS units that are defined with
|
||||
# This coped with some wacky UtBS units that were defined with
|
||||
# variant-spawning macros. The prototype comment looks like this:
|
||||
#wmllint: usage of "Desert Fighter" is fighter
|
||||
m = re.match('# *wmllint: usage of "([^"]*)" is +(.*)', lines[i])
|
||||
m = re.search('# *wmllint: usage of "([^"]*)" is +(.*)', lines[i])
|
||||
if m:
|
||||
usage[m.group(1)] = m.group(2).strip()
|
||||
unit_types.append(m.group(1))
|
||||
|
|
Loading…
Add table
Reference in a new issue