Tighten up the implementation of spell-checking a bit,

...and fix some edge cases it catches.  Also, implement a method to
check ancestor scomes in WmlIterator (not yet used).
This commit is contained in:
Eric S. Raymond 2008-11-03 19:47:46 +00:00
parent 0374fe356c
commit 7571ffb728
28 changed files with 74 additions and 63 deletions

View File

@ -32,9 +32,9 @@
description= _ "A noble by birth, the Princess has learnt swordplay with the greatest generals, and battle tactics with the greatest sages, making her both a great combatant and leader. Now battle-hardened and strong of will, she can now aid those around her in the art of combat."+{SPECIAL_NOTES}+{SPECIAL_NOTES_LEADERSHIP}+{SPECIAL_NOTES_SKIRMISHER}
die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
[attack]
name=sabre
description= _"sabre"
icon=attacks/sabre-human.png
name=saber
description= _"saber"
icon=attacks/saber-human.png
type=blade
range=melee
damage=13
@ -42,7 +42,7 @@
[/attack]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-200
@ -111,9 +111,9 @@
description= _ "A noble by birth, the Princess has learnt swordplay with the greatest generals, and battle tactics with the greatest sages, making her both a great combatant and leader. Now battle-hardened and strong of will, she can now aid those around her in the art of combat."{SPECIAL_NOTES}+{SPECIAL_NOTES_LEADERSHIP}+{SPECIAL_NOTES_SKIRMISHER}+{SPECIAL_NOTES_MAGICAL}
die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
[attack]
name=sabre
description= _"sabre"
icon=attacks/sabre-human.png
name=saber
description= _"saber"
icon=attacks/saber-human.png
type=blade
range=melee
damage=13
@ -146,7 +146,7 @@
[/attack_anim]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-200

View File

@ -29,9 +29,9 @@
description= _ "A noble by birth, the Princess has learnt swordplay with the greatest generals and battle tactics with the greatest sages, making her both a great combatant and leader. The units of lower level around the Princess will fight better due to her presence. The Princess is also nimble and dextrous, having skills like that of a thief."+{SPECIAL_NOTES}+{SPECIAL_NOTES_LEADERSHIP}
die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
[attack]
name=sabre
description= _"sabre"
icon=attacks/sabre-human.png
name=saber
description= _"saber"
icon=attacks/saber-human.png
type=blade
range=melee
damage=11
@ -39,7 +39,7 @@
[/attack]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-225
@ -110,9 +110,9 @@
description= _ "A noble by birth, the Princess has learnt swordplay with the greatest generals and battle tactics with the greatest sages, making her both a great combatant and leader. The units of lower level around the Princess will fight better due to her presence. The Princess is also nimble and dextrous, having skills like that of a thief."+{SPECIAL_NOTES}+{SPECIAL_NOTES_LEADERSHIP}+{SPECIAL_NOTES_MAGICAL}
die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
[attack]
name=sabre
description= _"sabre"
icon=attacks/sabre-human.png
name=saber
description= _"saber"
icon=attacks/saber-human.png
type=blade
range=melee
damage=11
@ -145,7 +145,7 @@
[/attack_anim]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-225

View File

@ -808,7 +808,7 @@
[option]
id=command_quit
message= "@I don't want to be in command any more! Take care of yourselves! (Disables AI_CONTROLLER)" # wmllint: ignore
message= "@I don't want to be in command any more! Take care of yourselves! (Disables AI_CONTROLLER)" # wmllint: ignore no spellcheck
[show_if]
[variable]
name=ai_controller.in_command

View File

@ -19,7 +19,7 @@
# fixed by storyline is a west-to-east road; player's troops
# should start near its west end, enemy near the east.
# wmllint: local spellink Marth-Tak
# wmllint: local spelling Marth-Tak
[side]
type="Dwarvish Fighter"

View File

@ -35,8 +35,8 @@
[/leading_anim]
[attack]
name=chainmace
description= _"chainmace"
name=morningstar
description= _"morningstar" # wmllint: no spellcheck (until name->id)
icon=attacks/mace-and-chain.png
type=impact
range=melee
@ -49,7 +49,7 @@
[attack_anim]
[filter_attack]
name=chainmace
name=morningstar
[/filter_attack]
[frame]
begin=-250

View File

@ -38,8 +38,8 @@
[/leading_anim]
[attack]
name=chainmace
description= _"chainmace"
name=morningstar
description= _"morningstar" # wmllint: no spellchheck (until name->id)
icon=attacks/mace-and-chain.png
type=impact
range=melee
@ -52,7 +52,7 @@
[attack_anim]
[filter_attack]
name=chainmace
name=morningstar
range=melee
[/filter_attack]
[frame]

View File

@ -40,8 +40,8 @@
[/leading_anim]
[attack]
name=chainmace
description= _"chainmace"
name=morningstar
description= _"morningstar" # wmllint: no spellcheck (until name->id)
icon=attacks/mace-and-chain.png
type=impact
range=melee
@ -54,7 +54,7 @@
[attack_anim]
[filter_attack]
name=chainmace
name=morningstar
[/filter_attack]
[frame]
begin=-250

View File

@ -1,4 +1,4 @@
#textdomain wesnoth-tb
0#textdomain wesnoth-tb
[scenario]
id=2_The_Chase
name= _ "The Chase"
@ -272,7 +272,7 @@
[/message]
[message]
role=speaker
message= _ "It is whispered that hungry ghosts ruling this forest. and kill everyone who dares to enter."
message= _ "It is whispered that hungry ghosts rule this forest, and kill everyone who dares to enter."
[/message]
[message]
speaker=Nil-Galion

View File

@ -298,6 +298,7 @@
[/ai]
[/side]
# wmllint: directory spelling Tanuil
[story]
[part]
story= _ "Chapter 8: I set out with a lightened heart and quickened step; we were going back up and I was sure that soon this underground gauntlet would be over. With the help of our new allies, I felt much more confident than I had before. Oh to feel the wind in my hair and the sun on my face. But for now we had many more miles to wend and in the monotony of the marching I let my mind wander to bigger matters."

View File

@ -30,7 +30,6 @@ victory_when_enemies_defeated=no
[/music]
# And the story. Disclaimer, introduction to the campaign, and first scenario
# wmllint: directory spelling Tanuil
[story]
[part]
story= _ "Note: This campaign is probably not the best one for beginners. It changes certain Wesnoth standards, such as the elves' stats and the day/night cycle. This campaign emphasizes role-playing elements and tends to have longer scenarios with changing objectives. For these reasons I strongly suggest that you occasionally save your game mid-scenario, so you won't lose all your progress if you get stuck and have to start over."

View File

@ -12,6 +12,8 @@
# Medium: 2 giant mudcrawlers, 2 small mudcrawlers
# Hard: 3 giant mudcrawlers, 1 small mudcrawler
# wmllint: local spelling Yasi Nisa
[event]
name=moveto
[filter]
@ -477,7 +479,6 @@
# villages. This might be not the most efficient way of doing thing when
# but it saves us from some macro abuse and awkward capture checks
# wmllint: local spelling Yasi Nisa
[event]
name=capture
[filter]

View File

@ -29,7 +29,7 @@
[/attack]
[attack]
name=lightbeam
description= _"lightbeam"
description= _"lightbeam" # wmllint: no spellcheck (until nane->id)
type=arcane
range=ranged
[specials]

View File

@ -29,7 +29,7 @@
[/attack]
[attack]
name=lightbeam
description= _"lightbeam"
description= _"lightbeam" # wmllint: no spellcheck (until name->id)
type=arcane
range=ranged
[specials]

View File

@ -17,9 +17,9 @@
description= _ "Young and brash, Fighters are skilled with swords and are vulnerable to attack from enemies. However, they have the potential to become great warriors one day."
die_sound={SOUND_LIST:HUMAN_FEMALE_DIE}
[attack]
name=sabre
description= _"sabre"
icon=attacks/sabre-human.png
name=saber
description= _"saber"
icon=attacks/saber-human.png
type=blade
range=melee
damage=6
@ -27,7 +27,7 @@
[/attack]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-225

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -72,16 +72,16 @@ Drakes originated from a chain of volcanic islands in the Great Ocean. A combina
# wmllint: general spellings dwarf dwarves dwarvish dwarven
# wmllint: general spellings Knalga Knalgan Vrug Moradin
# wmllint: general spellings muckle och busked intae
# wmllint: general spellings runesmith runesmiths
# wmllint: general spellings muckle och busked intae belike
# wmllint: general spellings runesmith runesmiths runelore
# wmllint: general spellings runecraft runecrafter runecrafters
# wmllint: general spellings dirtgrubber dirtgrubbers dirtgrubbing
# wmllint: general spellings runesmith runesmiths bonebag belike runelore
# wmllint: general spellings nae tae yer yerselves ye'll ye're ye'd ye've
# wmllint: general spellings ha' isna' havena' awa' canna' couldna' hasna'
# wmllint: general spellings oursel' o' dinna' unco' wi' brawlin' inta'
# wmllint: general spellings wouldna' willna' didna' dinna'
# wmllint: general spellings tryin' wi'out ta'en d'ye
# wmllint: general spellings bonebag
[race]
id=dwarf
male_name= _ "race^Dwarf"

View File

@ -32,7 +32,7 @@
[/attack]
[attack]
name=dragonstaff
description=_"dragonstaff"
description=_"dragonstaff" # wmllint: no spellcheck (until name->id)
type=pierce
range=ranged
damage=40

View File

@ -68,9 +68,9 @@ Experienced fencers, who often look the part, even if not actually of noble birt
[/frame]
[/death]
[attack]
name=sabre
description=_"sabre"
icon=attacks/sabre-human.png
name=saber
description=_"saber"
icon=attacks/saber-human.png
type=blade
range=melee
damage=5
@ -116,7 +116,7 @@ Experienced fencers, who often look the part, even if not actually of noble birt
[/attack_anim]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-250

View File

@ -17,7 +17,7 @@
usage=fighter
description= _ "Fencers belong to a school of thought that considers the armor most soldiers wear in combat to be their own worst enemy. While armor can only soften a blow, evading it leaves the defender completely unharmed. Being able to reliably dodge any offensive move is a luxury only afforded to the fit of body, and then only to those who endure rigorous training.
Outfitted with only a dagger and sabre, fencers are light on their feet and useful in many situations where their armor-bound peers are at a disadvantage. They take relish in dancing circles around troops like heavy infantry, mocking the weight of their full armor."+{SPECIAL_NOTES}+{SPECIAL_NOTES_SKIRMISHER}
Outfitted with only a dagger and saber, fencers are light on their feet and useful in many situations where their armor-bound peers are at a disadvantage. They take relish in dancing circles around troops like heavy infantry, mocking the weight of their full armor."+{SPECIAL_NOTES}+{SPECIAL_NOTES_SKIRMISHER}
die_sound={SOUND_LIST:HUMAN_DIE}
[resistance]
cold=90
@ -123,9 +123,9 @@ Outfitted with only a dagger and sabre, fencers are light on their feet and usef
[/frame]
[/death]
[attack]
name=sabre
description=_"sabre"
icon=attacks/sabre-human.png
name=saber
description=_"saber"
icon=attacks/saber-human.png
type=blade
damage=4
number=4
@ -189,7 +189,7 @@ Outfitted with only a dagger and sabre, fencers are light on their feet and usef
[/idle_anim]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-300

View File

@ -27,9 +27,9 @@ They usually have the luxury of choosing their appointments, and are free to roa
{ABILITY_SKIRMISHER}
[/abilities]
[attack]
name=sabre
description=_"sabre"
icon=attacks/sabre-human.png
name=saber
description=_"saber"
icon=attacks/saber-human.png
type=blade
range=melee
damage=7
@ -103,7 +103,7 @@ They usually have the luxury of choosing their appointments, and are free to roa
[/attack_anim]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-200
@ -156,7 +156,7 @@ They usually have the luxury of choosing their appointments, and are free to roa
[/attack_anim]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-200
@ -209,7 +209,7 @@ They usually have the luxury of choosing their appointments, and are free to roa
[/attack_anim]
[attack_anim]
[filter_attack]
name=sabre
name=saber
[/filter_attack]
[frame]
begin=-200

View File

@ -127,7 +127,7 @@ Though not trained for combat, they are a potent ally against magical or unnatur
[/attack]
[attack]
name=lightbeam
description=_"lightbeam"
description=_"lightbeam" # wmllint: no spellcheck (until name->id)
type=arcane
range=ranged
[specials]

View File

@ -105,7 +105,7 @@ Following a strict code of piety and honor, these men and women work tirelessly
[/attack]
[attack]
name=lightbeam
description=_"lightbeam"
description=_"lightbeam" # wmllint: no spellcheck (until name->id)
type=arcane
range=ranged
[specials]

View File

@ -71,7 +71,7 @@
[/attack]
[attack]
name=lightbeam
description=_"lightbeam"
description=_"lightbeam" # wmllint: no spellcheck (until name->id)
type=arcane
range=ranged
[specials]

View File

@ -68,7 +68,7 @@
[/attack]
[attack]
name=lightbeam
description=_"lightbeam"
description=_"lightbeam" # wmllint: no spellcheck (until name->id)
type=arcane
range=ranged
[specials]

View File

@ -43,7 +43,7 @@ The creation of these is no mean feat; the real danger in encountering one is th
[/death]
[attack]
name=baneblade
description=_"baneblade"
description=_"baneblade" # wmllint: no spellcheck (until name->id)
type=arcane
range=melee
damage=9

View File

@ -18,7 +18,7 @@
die_sound=wail-long.wav
[attack]
name=baneblade
description=_"baneblade"
description=_"baneblade" # wmllint: no spellcheck (until name->id)
type=arcane
range=melee
damage=6

View File

@ -306,6 +306,10 @@ Important Attributes:
"""Emit a locator string compatible with Emacs compilation mode."""
return '"%s", line %d:' % (self.fname, self.lineno+1)
def ancestors(self):
"""Return a list of tags enclosing this location."""
return tuple(map(lambda x: x.element, self.scopes))
def hasNext(self):
"""Some loops may wish to check this method instead of calling next()
and handling StopIteration... note: inaccurate for ScopeIterators"""

View File

@ -136,6 +136,8 @@ linechanges = (
("canyon=", "unwalkable="),
# This changed after 1.5.2
("advanceto=", "advances_to="),
# This changed after 1.5.5, to enable mechanical spellchecking
("sabre", "saber"),
)
def validate_stack(stack, filename, lineno):
@ -295,6 +297,8 @@ declared_spellings = {"GLOBAL":["I'm", "I've", "I'd", "I'll",
"heh", "aide-de-camp", "teleportation",
"hellspawn", "hurrah", "crafters", "bided",
"overmatched", "stygian", "numbskulls",
"axe", "greatsword", "ballista", "glaive",
"morningstar",
# game jargon
"melee", "arcane", "day/night",
"hitpoint", "hitpoints", "FFA",
@ -1152,7 +1156,9 @@ def spellcheck(fn, d):
else:
local_spellings += declared_spellings.get(up,[])
up = os.path.dirname(up)
local_spellings = filter(lambda w: not d.check(w), local_spellings)
map(d.add_to_session, local_spellings)
# Process this individual file
for nav in WmlIterator(filename=fn):
#print "element=%s, text=%s" % (nav.element, `nav.text`)
# Recognize local spelling exceptions
@ -1246,7 +1252,7 @@ def spellcheck(fn, d):
continue
print nav.whereami(), 'possible misspelling "%s"' % token
# Take exceptions from name, id, and type fields
if nav.element in ("name=", "id=", "type="):
if nav.element == "id=":
(key, prefix, value, comment) = parse_attribute(nav.text)
value = string_strip(value)
if value: