Skip to content

Commit

Permalink
wmllint: automatically remove {MAGENTA_IS_THE_TEAM_COLOR}
Browse files Browse the repository at this point in the history
  • Loading branch information
Elvish-Hunter committed Dec 3, 2021
1 parent ca6cafb commit 912625b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -43,6 +43,7 @@
* Correct unit display adjustments on certain tiles when at zoom level other than 100% (issue #5974)
* Fix the engine exiting immediately due to a corrupt .mo file (issue #6194)
* Removed support for writing BMP screenshots (PR #6206).
* wmllint now automatically removes {MAGENTA_IS_THE_TEAM_COLOR}.

## Version 1.16.0+dev
### Add-ons client
Expand Down
16 changes: 16 additions & 0 deletions data/tools/wmllint
Expand Up @@ -2681,6 +2681,22 @@ def hack_syntax(filename, lines):
in_side_one_tag = False
side_one_tag_needs_side_one = True
break
# handle removal of {MAGENTA_IS_THE_TEAM_COLOR}
for i, line in enumerate(lines):
if "no-syntax-rewrite" in line:
break
m = re.match(r"(\s*)\{MAGENTA_IS_THE_TEAM_COLOR\}(.*)", line)
if m:
new_line = m.group(1) + m.group(2).lstrip()
if new_line.isspace():
# only empty spaces, make the line blank
# don't remove the line to not alter the other for cycles
lines[i] = "\n"
else:
# keep indentation and comments
lines[i] = new_line + "\n"
print('"{}", line {}: removed MAGENTA_IS_THE_TEAM_COLOR'.format(filename,
i+1))
# More syntax transformations would go here.
return lines

Expand Down

0 comments on commit 912625b

Please sign in to comment.