mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 15:50:26 +00:00
All main WML tools: replaced tabs with spaces
This commit is contained in:
parent
ad881b5d0b
commit
7fa2943683
@ -420,7 +420,7 @@ Important Attributes:
|
|||||||
self.element, nextScopes = self.parseElements(self.text)
|
self.element, nextScopes = self.parseElements(self.text)
|
||||||
self.nextScopes = []
|
self.nextScopes = []
|
||||||
for elem in nextScopes:
|
for elem in nextScopes:
|
||||||
# remember scopes by storing a copy of the iterator
|
# remember scopes by storing a copy of the iterator
|
||||||
copyItor = self.copy()
|
copyItor = self.copy()
|
||||||
copyItor.element = elem
|
copyItor.element = elem
|
||||||
self.nextScopes.append(copyItor)
|
self.nextScopes.append(copyItor)
|
||||||
|
@ -107,7 +107,7 @@ class Forest:
|
|||||||
for directory in dirpath:
|
for directory in dirpath:
|
||||||
subtree = []
|
subtree = []
|
||||||
rooted = False
|
rooted = False
|
||||||
if os.path.isdir(directory): # So we skip .cfgs in a UMC mirror
|
if os.path.isdir(directory): # So we skip .cfgs in a UMC mirror
|
||||||
oldmain = os.path.join(os.path.dirname(directory), os.path.basename(directory) + '.cfg')
|
oldmain = os.path.join(os.path.dirname(directory), os.path.basename(directory) + '.cfg')
|
||||||
if os.path.isfile(oldmain):
|
if os.path.isfile(oldmain):
|
||||||
subtree.append(oldmain)
|
subtree.append(oldmain)
|
||||||
@ -320,7 +320,7 @@ def actualtype(a):
|
|||||||
elif a in ("lawful", "neutral", "chaotic", "liminal"):
|
elif a in ("lawful", "neutral", "chaotic", "liminal"):
|
||||||
atype = "alignment"
|
atype = "alignment"
|
||||||
elif a.startswith("{") or a.endswith("}") or a.startswith("$"):
|
elif a.startswith("{") or a.endswith("}") or a.startswith("$"):
|
||||||
atype = None # Can't tell -- it's a macro expansion
|
atype = None # Can't tell -- it's a macro expansion
|
||||||
elif re.match(image_reference, a) or a == "unit_image":
|
elif re.match(image_reference, a) or a == "unit_image":
|
||||||
atype = "image"
|
atype = "image"
|
||||||
elif re.match(r"(\*|[A-Z][a-z]+)\^([A-Z][a-z\\|/]+\Z)?", a):
|
elif re.match(r"(\*|[A-Z][a-z]+)\^([A-Z][a-z\\|/]+\Z)?", a):
|
||||||
@ -541,7 +541,7 @@ class CrossRef:
|
|||||||
name = tokens[1]
|
name = tokens[1]
|
||||||
here = Reference(namespace, filename, n+1, line, args=tokens[2:])
|
here = Reference(namespace, filename, n+1, line, args=tokens[2:])
|
||||||
here.hash = hashlib.md5()
|
here.hash = hashlib.md5()
|
||||||
here.docstring = line.lstrip()[8:] # Strip off #define_
|
here.docstring = line.lstrip()[8:] # Strip off #define_
|
||||||
state = "macro_header"
|
state = "macro_header"
|
||||||
continue
|
continue
|
||||||
elif state != 'outside' and line.strip().endswith("#enddef"):
|
elif state != 'outside' and line.strip().endswith("#enddef"):
|
||||||
@ -947,9 +947,9 @@ def vcunmove(src, dst):
|
|||||||
"Revert the result of a previous move (before commit)."
|
"Revert the result of a previous move (before commit)."
|
||||||
(path, base) = os.path.split(src)
|
(path, base) = os.path.split(src)
|
||||||
if os.path.exists(os.path.join(path, ".git")):
|
if os.path.exists(os.path.join(path, ".git")):
|
||||||
return "git checkout %s" % dst # Revert the add at the destination
|
return "git checkout %s" % dst # Revert the add at the destination
|
||||||
return "git rm " + dst # Remove the moved copy
|
return "git rm " + dst # Remove the moved copy
|
||||||
return "git checkout %s" % src # Revert the deletion
|
return "git checkout %s" % src # Revert the deletion
|
||||||
else:
|
else:
|
||||||
return "echo 'cannot unmove %s from %s, .git is missing'" % (src, dst)
|
return "echo 'cannot unmove %s from %s, .git is missing'" % (src, dst)
|
||||||
|
|
||||||
@ -965,7 +965,7 @@ def vcundelete(src):
|
|||||||
"Revert the result of a previous delete (before commit)."
|
"Revert the result of a previous delete (before commit)."
|
||||||
(path, base) = os.path.split(src)
|
(path, base) = os.path.split(src)
|
||||||
if os.path.exists(os.path.join(path, ".git")):
|
if os.path.exists(os.path.join(path, ".git")):
|
||||||
return "git checkout %s" % src # Revert the deletion
|
return "git checkout %s" % src # Revert the deletion
|
||||||
else:
|
else:
|
||||||
return "echo 'cannot undelete %s, .git is missing'" % src
|
return "echo 'cannot undelete %s, .git is missing'" % src
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ def reindent(name, infp, outfp):
|
|||||||
lasttag = ""
|
lasttag = ""
|
||||||
countlines = 0
|
countlines = 0
|
||||||
countblanks = 0
|
countblanks = 0
|
||||||
multitag = re.compile(r"\[a-z]].*\[[a-z]") # Avoid triggering on arrays
|
multitag = re.compile(r"\[a-z]].*\[[a-z]") # Avoid triggering on arrays
|
||||||
for line in infp:
|
for line in infp:
|
||||||
countlines += 1
|
countlines += 1
|
||||||
# User may declare indentation exceptions
|
# User may declare indentation exceptions
|
||||||
@ -265,7 +265,7 @@ def convertor(linefilter, arglist, exclude):
|
|||||||
if dryrun:
|
if dryrun:
|
||||||
os.remove(filename + ".out")
|
os.remove(filename + ".out")
|
||||||
else:
|
else:
|
||||||
os.remove(filename) # For Windows portability
|
os.remove(filename) # For Windows portability
|
||||||
# There's a tiny window open if you keyboard-
|
# There's a tiny window open if you keyboard-
|
||||||
# interrupt here. It's unavoidable, because
|
# interrupt here. It's unavoidable, because
|
||||||
# there's no known way to do an atomic rename
|
# there's no known way to do an atomic rename
|
||||||
|
@ -589,7 +589,7 @@ linechanges = (
|
|||||||
("flat/grass-r3", "flat/grass3"),
|
("flat/grass-r3", "flat/grass3"),
|
||||||
("flat/grass-r2", "flat/grass2"),
|
("flat/grass-r2", "flat/grass2"),
|
||||||
("flat/grass-r1", "flat/grass1"),
|
("flat/grass-r1", "flat/grass1"),
|
||||||
("second_value=", "value_second="), # Correct earlier wmllint error
|
("second_value=", "value_second="), # Correct earlier wmllint error
|
||||||
(".stones", ".petrifies"),
|
(".stones", ".petrifies"),
|
||||||
("stones=", "petrifies="),
|
("stones=", "petrifies="),
|
||||||
# Changes just before 1.9.1
|
# Changes just before 1.9.1
|
||||||
@ -625,7 +625,7 @@ linechanges = (
|
|||||||
('FLAG_VARIANT ragged','FLAG_VARIANT6 ragged'),
|
('FLAG_VARIANT ragged','FLAG_VARIANT6 ragged'),
|
||||||
('FLAG_VARIANT "ragged"','FLAG_VARIANT6 ragged'),
|
('FLAG_VARIANT "ragged"','FLAG_VARIANT6 ragged'),
|
||||||
|
|
||||||
# Changed in 1.11.15.
|
# Changed in 1.11.15.
|
||||||
("fight_on_without_leader=yes","defeat_condition=no_units_left"),
|
("fight_on_without_leader=yes","defeat_condition=no_units_left"),
|
||||||
("fight_on_without_leader=no","defeat_condition=no_leader_left"),
|
("fight_on_without_leader=no","defeat_condition=no_leader_left"),
|
||||||
("remove_from_carryover_on_leaders_loss=yes","remove_from_carryover_on_defeat=yes"),
|
("remove_from_carryover_on_leaders_loss=yes","remove_from_carryover_on_defeat=yes"),
|
||||||
@ -693,7 +693,7 @@ def validate_on_pop(tagstack, closer, filename, lineno):
|
|||||||
|
|
||||||
def within(tag):
|
def within(tag):
|
||||||
"Did the specified tag lead one of our enclosing contexts?"
|
"Did the specified tag lead one of our enclosing contexts?"
|
||||||
if type(tag) == type(()): # Can take a list.
|
if type(tag) == type(()): # Can take a list.
|
||||||
for t in tag:
|
for t in tag:
|
||||||
if within(t):
|
if within(t):
|
||||||
return True
|
return True
|
||||||
@ -704,7 +704,7 @@ def within(tag):
|
|||||||
|
|
||||||
def under(tag):
|
def under(tag):
|
||||||
"Did the specified tag lead the latest context?"
|
"Did the specified tag lead the latest context?"
|
||||||
if type(tag) == type(()): # Can take a list.
|
if type(tag) == type(()): # Can take a list.
|
||||||
for t in tag:
|
for t in tag:
|
||||||
if within(t):
|
if within(t):
|
||||||
return True
|
return True
|
||||||
@ -754,7 +754,7 @@ notepairs = [
|
|||||||
("{ABILITY_FEEDING}", "{SPECIAL_NOTES_FEEDING}"),
|
("{ABILITY_FEEDING}", "{SPECIAL_NOTES_FEEDING}"),
|
||||||
("{WEAPON_SPECIAL_BERSERK}", "{SPECIAL_NOTES_BERSERK}"),
|
("{WEAPON_SPECIAL_BERSERK}", "{SPECIAL_NOTES_BERSERK}"),
|
||||||
("{WEAPON_SPECIAL_BACKSTAB}", "{SPECIAL_NOTES_BACKSTAB}"),
|
("{WEAPON_SPECIAL_BACKSTAB}", "{SPECIAL_NOTES_BACKSTAB}"),
|
||||||
("{WEAPON_SPECIAL_PLAGUE", "{SPECIAL_NOTES_PLAGUE}"), # No } deliberately
|
("{WEAPON_SPECIAL_PLAGUE", "{SPECIAL_NOTES_PLAGUE}"), # No } deliberately
|
||||||
("{WEAPON_SPECIAL_SLOW}", "{SPECIAL_NOTES_SLOW}"),
|
("{WEAPON_SPECIAL_SLOW}", "{SPECIAL_NOTES_SLOW}"),
|
||||||
("{WEAPON_SPECIAL_PETRIFY}", "{SPECIAL_NOTES_PETRIFY}"),
|
("{WEAPON_SPECIAL_PETRIFY}", "{SPECIAL_NOTES_PETRIFY}"),
|
||||||
("{WEAPON_SPECIAL_MARKSMAN}", "{SPECIAL_NOTES_MARKSMAN}"),
|
("{WEAPON_SPECIAL_MARKSMAN}", "{SPECIAL_NOTES_MARKSMAN}"),
|
||||||
@ -955,7 +955,7 @@ def pangoize(message, filename, line):
|
|||||||
if oldstyle not in message:
|
if oldstyle not in message:
|
||||||
continue
|
continue
|
||||||
where = message.find(oldstyle)
|
where = message.find(oldstyle)
|
||||||
if message[where - 1] != '"': # Start of string only
|
if message[where - 1] != '"': # Start of string only
|
||||||
continue
|
continue
|
||||||
if message.strip()[-1] != '"':
|
if message.strip()[-1] != '"':
|
||||||
print('"%s", line %d: %s highlight at start of multiline string requires manual fix.' % (filename, line, oldstyle))
|
print('"%s", line %d: %s highlight at start of multiline string requires manual fix.' % (filename, line, oldstyle))
|
||||||
@ -971,7 +971,7 @@ def pangoize(message, filename, line):
|
|||||||
if "<" in message or ">" in message:
|
if "<" in message or ">" in message:
|
||||||
reduced = pangostrip(message)
|
reduced = pangostrip(message)
|
||||||
if "<" in reduced or ">" in reduced:
|
if "<" in reduced or ">" in reduced:
|
||||||
if message == reduced: # No pango markup
|
if message == reduced: # No pango markup
|
||||||
here = message.find('<')
|
here = message.find('<')
|
||||||
if message[here:here+4] != "<":
|
if message[here:here+4] != "<":
|
||||||
message = message[:here] + "<" + message[here+1:]
|
message = message[:here] + "<" + message[here+1:]
|
||||||
@ -1301,7 +1301,7 @@ def global_sanity_check(filename, lines):
|
|||||||
print('"%s", line %d: side number %s is out of sequence (%d expected)' \
|
print('"%s", line %d: side number %s is out of sequence (%d expected)' \
|
||||||
% (filename, num, value, sidecount))
|
% (filename, num, value, sidecount))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass # Ignore ill-formed integer literals
|
pass # Ignore ill-formed integer literals
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
# Sanity check ellipses
|
# Sanity check ellipses
|
||||||
@ -1671,13 +1671,13 @@ def global_sanity_check(filename, lines):
|
|||||||
# print('"%s", line %d: extraneous space in translatable string'\
|
# print('"%s", line %d: extraneous space in translatable string'\
|
||||||
# % (filename, i+1))
|
# % (filename, i+1))
|
||||||
# Check correctness of translation marks and descriptions
|
# Check correctness of translation marks and descriptions
|
||||||
if key.startswith("#"): # FIXME: parse_attribute is confused.
|
if key.startswith("#"): # FIXME: parse_attribute is confused.
|
||||||
pass
|
pass
|
||||||
elif key.startswith("{"):
|
elif key.startswith("{"):
|
||||||
pass
|
pass
|
||||||
elif key == 'letter': # May be led with _s for void
|
elif key == 'letter': # May be led with _s for void
|
||||||
pass
|
pass
|
||||||
elif key in ('name', 'male_name', 'female_name', 'value'): # FIXME: check this someday
|
elif key in ('name', 'male_name', 'female_name', 'value'): # FIXME: check this someday
|
||||||
pass
|
pass
|
||||||
elif key == "variation_name":
|
elif key == "variation_name":
|
||||||
if markcheck and not has_tr_mark:
|
if markcheck and not has_tr_mark:
|
||||||
@ -1740,7 +1740,7 @@ def global_sanity_check(filename, lines):
|
|||||||
if not no_text:
|
if not no_text:
|
||||||
if not textdomains:
|
if not textdomains:
|
||||||
print('"%s", line 1: no textdomain string' % filename)
|
print('"%s", line 1: no textdomain string' % filename)
|
||||||
elif textdomains[0] == 1: # Multiples are OK if first is on line 1
|
elif textdomains[0] == 1: # Multiples are OK if first is on line 1
|
||||||
pass
|
pass
|
||||||
elif len(textdomains) > 1:
|
elif len(textdomains) > 1:
|
||||||
print('"%s", line %d: multiple textdomain strings on lines %s' % \
|
print('"%s", line %d: multiple textdomain strings on lines %s' % \
|
||||||
@ -2140,7 +2140,7 @@ def is_map(filename):
|
|||||||
"Is this file a map?"
|
"Is this file a map?"
|
||||||
return filename.endswith(".map")
|
return filename.endswith(".map")
|
||||||
|
|
||||||
if 0: # Not used, as there are currently no defined map transforms
|
if 0: # Not used, as there are currently no defined map transforms
|
||||||
class maptransform_error:
|
class maptransform_error:
|
||||||
"Error object to be thrown by maptransform."
|
"Error object to be thrown by maptransform."
|
||||||
def __init__(self, infile, inline, type):
|
def __init__(self, infile, inline, type):
|
||||||
@ -2160,7 +2160,7 @@ if 0: # Not used, as there are currently no defined map transforms
|
|||||||
raise maptransform_error(filename, baseline+y+1,
|
raise maptransform_error(filename, baseline+y+1,
|
||||||
"unrecognized map element at line %d" % (y,))
|
"unrecognized map element at line %d" % (y,))
|
||||||
|
|
||||||
tagstack = [] # For tracking tag nesting
|
tagstack = [] # For tracking tag nesting
|
||||||
|
|
||||||
def outermap(func, inmap):
|
def outermap(func, inmap):
|
||||||
"Apply a transformation based on neighborhood to the outermost ring."
|
"Apply a transformation based on neighborhood to the outermost ring."
|
||||||
@ -2324,7 +2324,7 @@ def translator(filename, mapxforms, textxform):
|
|||||||
newdata.append(newline + terminator)
|
newdata.append(newline + terminator)
|
||||||
fields = newline.split("#")
|
fields = newline.split("#")
|
||||||
trimmed = fields[0]
|
trimmed = fields[0]
|
||||||
destringed = re.sub('"[^"]*"', '', trimmed) # Ignore string literals
|
destringed = re.sub('"[^"]*"', '', trimmed) # Ignore string literals
|
||||||
comment = ""
|
comment = ""
|
||||||
if len(fields) > 1:
|
if len(fields) > 1:
|
||||||
comment = fields[1]
|
comment = fields[1]
|
||||||
@ -2399,7 +2399,7 @@ def translator(filename, mapxforms, textxform):
|
|||||||
if transformed[i] == '\n':
|
if transformed[i] == '\n':
|
||||||
if singleline:
|
if singleline:
|
||||||
singleline = False
|
singleline = False
|
||||||
if not display_state and quotecount % 2 and transformed[i:i+2] != "\n\n" and transformed[i-1:i+1] != "\n\n":
|
if not display_state and quotecount % 2 and transformed[i:i+2] != "\n\n" and transformed[i-1:i+1] != "\n\n":
|
||||||
print('"%s", line %d: nonstandard word-wrap style within message' % (filename, linecount))
|
print('"%s", line %d: nonstandard word-wrap style within message' % (filename, linecount))
|
||||||
linecount += 1
|
linecount += 1
|
||||||
elif transformed[i-7:i] == "message" and transformed[i] == '=':
|
elif transformed[i-7:i] == "message" and transformed[i] == '=':
|
||||||
@ -2620,7 +2620,7 @@ def allcfgfiles(directory):
|
|||||||
for name in files:
|
for name in files:
|
||||||
if interesting(os.path.join(root, name)):
|
if interesting(os.path.join(root, name)):
|
||||||
datafiles.append(os.path.join(root, name))
|
datafiles.append(os.path.join(root, name))
|
||||||
datafiles.sort() # So diffs for same campaigns will cluster in reports
|
datafiles.sort() # So diffs for same campaigns will cluster in reports
|
||||||
return map(os.path.normpath, datafiles)
|
return map(os.path.normpath, datafiles)
|
||||||
|
|
||||||
def help():
|
def help():
|
||||||
|
@ -330,9 +330,9 @@ sudo apt-get install python-pil""", file=sys.stderr)
|
|||||||
if entry.docstring:
|
if entry.docstring:
|
||||||
lines = entry.docstring.split("\n")
|
lines = entry.docstring.split("\n")
|
||||||
header = lines.pop(0).split()
|
header = lines.pop(0).split()
|
||||||
if lines and not lines[-1]: # Ignore trailing blank lines
|
if lines and not lines[-1]: # Ignore trailing blank lines
|
||||||
lines.pop()
|
lines.pop()
|
||||||
if not lines: # Ignore definitions without a docstring
|
if not lines: # Ignore definitions without a docstring
|
||||||
continue
|
continue
|
||||||
outstr += "\n<dt id='" + header[0] + "'>\n"
|
outstr += "\n<dt id='" + header[0] + "'>\n"
|
||||||
outstr += "<em class='macro_name'>" + header[0] + "</em>"
|
outstr += "<em class='macro_name'>" + header[0] + "</em>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user