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 4bf0476 commit 35676b0
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 @@ -17,6 +17,7 @@
### WML Engine
### Miscellaneous and Bug Fixes
* Password storage was fixed to work with multiple accounts (PR #6290)
* wmllint now automatically removes {MAGENTA_IS_THE_TEAM_COLOR}.

## Version 1.16.1
### Add-ons server
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 35676b0

Please sign in to comment.