Systematically doublequote enclose IDs containing single quotes.

This avoids confusing wesnoth-mode.el.
This commit is contained in:
Eric S. Raymond 2008-11-10 11:25:55 +00:00
parent 741adce23c
commit 434d0bcf28
6 changed files with 20 additions and 7 deletions

View file

@ -362,7 +362,7 @@
[store_unit]
[filter]
id=Li'sar
id="Li'sar"
[/filter]
kill=yes

View file

@ -318,7 +318,7 @@
[/message]
[message]
speaker=Kapou'e
speaker="Kapou'e"
message= _ "Grüü is right. It is not wise to let these undead remain here cutting off our supply lines and path of retreat. In these days of turmoil, we don't know what lies ahead, so it is best not to leave any threats in our rear."
[/message]

View file

@ -418,7 +418,7 @@
value=0
[/set_variable]
# create AI=guardian units. They can't move unless an enemy
# create AI="guardian units. They can't move unless an enemy"
# moves nearby. I create them at the beginning because when the
# player sees them, events will fire.

View file

@ -398,7 +398,7 @@
[/entry]
[entry]
name = "Gideon Chia (Deonjo)"
comment = "new 'units' icon for general status bar"
comment ="new 'units' icon for general status bar"
[/entry]
[entry]
name = "Highhole"

View file

@ -2,7 +2,7 @@
[unit_type]
id=Skeletal Dragon
name= _ "Skeletal Dragon"
#not 'race=monster', because we need the not_living attribute
#not 'race="monster', because we need the not_living attribute"
race=undead
image="units/monsters/skeletal-dragon.png"
hitpoints=86

View file

@ -847,7 +847,20 @@ def hack_syntax(filename, lines):
n = "NEW_BATTLE"
x = int(m.group(2)) + 5
y = int(m.group(3)) + 5
lines[i] = lines[i][:m.start(0)] +("{%s %d %d}" % (n, x, y)) + lines[i][m.end(0):]
lines[i] = lines[i][:m.start(0)] +("{%s %d %d}" % (n, x, y)) + lines[i][m.end(0):]
# Fix bare strings containing single quotes; these confuse wesnoth-mode.el
for i in range(len(lines)):
if "no-syntax-rewrite" in lines[i]:
break
elif "'" in lines[i]:
try:
(key, prefix, value, comment) = parse_attribute(lines[i])
if "'" in value and value[0].isalpha() and value[-1].isalpha():
lines[i] = prefix + '"' + value + '"' + comment + "\n"
if verbose:
print '"%s", line %d: quote-enclosing attribute value.'%(filename, i+1)
except TypeError:
pass
# More syntax transformations would go here.
return lines
@ -1506,7 +1519,7 @@ if __name__ == '__main__':
sys.stderr.write("wmllint: internal error on %s\n" % fn)
(exc_type, exc_value, exc_traceback) = sys.exc_info()
raise exc_type, exc_value, exc_traceback
if not clean and not revert:
if not clean and not diffs and not revert:
# Consistency-check everything we got from the file scans
consistency_check()
# Attempt a spell-check