Author: esr
Date: Mon Nov  3 08:17:31 2008
New Revision: 30563

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30563&view=rev
Log:
Teach the spellchecker to handle another edge case.

Modified:
    trunk/data/tools/wmllint

Modified: trunk/data/tools/wmllint
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmllint?rev=30563&r1=30562&r2=30563&view=diff
==============================================================================
--- trunk/data/tools/wmllint (original)
+++ trunk/data/tools/wmllint Mon Nov  3 08:17:31 2008
@@ -1154,6 +1154,7 @@
             up = os.path.dirname(up)
     map(d.add_to_session, local_spellings)
     for nav in WmlIterator(filename=fn):
+        #print "element=%s, text=%s" % (nav.element, `nav.text`)
         # Recognize local spelling exceptions
         if not nav.element and "#" in nav.text:
             comment = nav.text[nav.text.index("#"):]
@@ -1170,6 +1171,10 @@
                 continue
             if value.startswith("_"):
                 value = value[1:].strip()
+            # Remove line continuations, they interfere with string-stripping
+            value = value.strip()
+            if value.endswith("+"):
+                value = value[:-1].rstrip()
             value = string_strip(value)
             value = value.replace("...", " ")
             value = value.replace("''", "")
@@ -1183,17 +1188,11 @@
             for token in value.split():
                 if d.check(token):
                     continue
-                while token and token[0] in " \t([EMAIL PROTECTED]'_":
+                while token and token[0] in " \t([EMAIL PROTECTED]'%_":
                     token = token[1:]
                 while token and token[-1] in "_-*').,:;?!& \t":
                     token = token[:-1]
-                if token.startswith("%"):
-                    continue
-                if token.startswith("$"):
-                    continue
-                if token and token[0].isdigit():
-                    continue
-                if not token:
+                if not token or token.startswith("$") or token[0].isdigit():
                     continue
                 token = string_strip(token)
                 if token and d.check(token):
@@ -1446,6 +1445,10 @@
             try:
                 import enchant
                 d = enchant.Dict("en_US")
+                checker = d.provider.desc
+                if checker.endswith(" Provider"):
+                    checker = checker[:-9]
+                print "# Spell-checking with", checker
                 for word in declared_spellings["GLOBAL"]:
                     d.add_to_session(word.lower())
                 for dir in arguments:


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to