Commit graph

2320 commits

Author SHA1 Message Date
Groggy Dice
98abe1ea42 wmllint: rewrite "who" magic comment to match exact macro name
Previously, the string only needed to match part of the macro. However, this
left too much room for unintended matches. This change is also quicker for
wmllint to process.
2014-01-03 10:35:22 -05:00
Ignacio R. Morelle
6c58f9539a Remove file that doesn't belong in the Git repository 2014-01-01 02:23:47 -03:00
Ignacio R. Morelle
1d2a59b0ab addons.w.o: New Year copyright update 2014-01-01 02:18:05 -03:00
Ignacio R. Morelle
503492dc96 website: New Year copyright update 2014-01-01 02:17:42 -03:00
Ignacio R. Morelle
785d6c8a17 units.w.o: New Year copyright update 2014-01-01 02:16:52 -03:00
fendrin
a564eda0c1 Remove everything related to [editor_tool_hint].
This tag is obsolete for ages and most likely not used by any UMC
designer.
2013-12-31 12:29:44 +01:00
Allefant
3a74b229bd [wmlparser2] added test case to wmlparser2.py 2013-12-30 18:37:31 +01:00
Alexander van Gessel
0c2d8564ef Improve wmlparser2 compatibility with the C++ parser
After a line ending in a '+', the C++ parser ignores any number of newlines,
wmlparser2 only ignored a single one. This case did not appear in mainline.
2013-12-30 15:46:53 +01:00
mattsc
d5e27a2e3f Correct the example given for MODIFY_AI_ADD_ASPECT
The [facet] tag is needed, but was not shown.
2013-12-27 10:20:24 -08:00
mattsc
04b8609149 Update auto-generated macro reference page with AI macros 2013-12-26 20:03:24 -08:00
fendrin
2709197594 Refactored the time of day schedule related images and macros.
This moves the after the fall schedule into core to grant that the
debian package wesnoth-editor does not depend on wesnoth-utbs.

Also, the images now life in their own subdirectories.

Wmllint has been updated to take care about the changed paths.
2013-12-22 07:32:12 +01:00
Groggy Dice
e22e204d67 wmllint: recognize characters in RECALL_XY 2013-12-20 04:52:05 -05:00
Groggy Dice
9b03262d04 parse whofield macros to recognize unit id fields
Also, explain usage of the "whofield" magic comment in the introduction
2013-12-20 04:51:52 -05:00
Groggy Dice
5c85e80487 create magic comment "whofield" for id fields of non-core macros
Although we can now auto-recognize characters in the core NAMED_*UNIT macros,
campaigns may have their own recruit/recall macros. This comment will tell
wmllint which field contains the macro's id.

The basic format is 'wmllint: whofield <macro> <num>'. This commit sets up the
dictionary, the next commit will actually parse the macros. It will explain
more details about how to use this magic comment in wmllint's introduction.
2013-12-20 04:51:48 -05:00
Groggy Dice
39557e8807 auto-recognize RECALL characters
Although this is not a core macro (yet - I've been meaning to ask why Wesnoth doesn't have core recall macros), it is used in many UMC projects in a consistent format, making it a de-facto standard.  Test that the macro has only one field, to make sure it isn't deviating from the format.
2013-12-17 04:48:57 -05:00
Groggy Dice
6dde83c3ac auto-recognize the people in the NAMED_*UNIT macros
If we have a regex match for the macro, we parse it and see if it meets key tests:

* There are at least 7 arguments parsed (NAMED_UNIT can have extra WML).
* The original regex could also match UMC macros, like "Attack of the Western Cavalry"'s NAMED_SHIP_UNIT. To make sure that such macros are following the format of the core macros, we check that the side, x, and y fields are numbers, or variables/macros consistent with those fields.
* Also make sure that the id field isn't blank. Not only would adding an empty id to the list of present characters be pointless, that list is added to spellings, and zero-length entries crash the spell-check.

If all those tests are passed, we append the id argument to the list of the present.

I also tweak the wording in the intro about the "wmllint: recognize" magic comment to reflect that wmllint is now recognizing ids in some macros.
2013-12-17 04:48:54 -05:00
Groggy Dice
c33b4c47ad update 1.4's LOYAL_UNIT macro to NAMED_LOYAL_UNIT
If an instance of LOYAL_UNIT is encountered, parse it for the number of fields.  If the number matches the old 1.4 macro, replace the string.
2013-12-17 04:48:51 -05:00
Groggy Dice
8660806c42 change instring to preserve quotes when not used to enclose a macro field
As it was, the code was excluding all quotes from arg, even in translatable strings.  Although this did not break any code that uses the args, I don't care for that behavior.
2013-12-17 04:48:48 -05:00
Groggy Dice
195399bcb2 replace startswith with re.match in finding lines that begin with macros
This will help later in searching the string created by re.match.
2013-12-17 04:48:45 -05:00
Groggy Dice
f2391f0966 preserve spaces inside parentheses for arg
During testing, I found that spaces inside quotes were preserved by the "instring" code, but not spaces inside naked parentheses. For example, "(Elvish Rider)" would be turned into "ElvishRider". This fix keeps interior whitespace from being discarded; the problem of leading and trailing whitespace is dealt with by stripping the arg before appending it to args.
2013-12-17 04:48:42 -05:00
Groggy Dice
7a014e8030 refactor macro reference-parsing into its own function
I have need for a macro-parsing ability, and realized that there was already existing code locked inside the CrossRef class.
2013-12-17 04:48:39 -05:00
Groggy Dice
096417df47 create a magic comment for appending custom usage classes
This will keep non-core usage types from being described as a "non-standard usage class" in recruitment error messages. These error messages will only be triggered if there is a mismatch between recruits and recruitment patterns, so this magic comment is low-priority.

It was suggested that wmllint could auto-detect new usage values in unit files, and automatically append them to the list of recognized usage types. This was rejected because of the possibility of adding misspelled or mistaken usage types.
2013-12-17 04:48:37 -05:00
Groggy Dice
990ac9a901 note when recruitment mismatches involve non-standard usage classes
When recruitment patterns include bogus usage classes, it will trigger a message during the consistency check. However, this check won't tell you whether your problem is with the usage classes or the recruits. For example, if you get a message that "no light fighter units are recruitable", your first thought might be that you didn't include a light fighter unit in the recruit list. The message doesn't clue you in directly that the light fighter simply doesn't exist in mainline.

Now a clause will be added to the message when non-mainline recruitment classes are involved, alerting designers when bogus usage classes are involved, but mild enough that it hopefully won't scare away authors legitimately seeking to use custom classes.

This replaces the old usage check. The next commit will add a magic comment for appending custom usage types.
2013-12-17 04:48:34 -05:00
fendrin
02adc2d2fa Update of the emacs wml mode's database. 2013-12-10 14:42:26 +01:00
Elias Pschernig
12700cd539 [units.wesnoth.org] fix typo 2013-12-07 16:55:01 +01:00
Elias Pschernig
adf7cdf0e9 [units.wesnoth.org] Adjust for new WML terrain_types 2013-12-06 17:58:48 +01:00
Ignacio R. Morelle
b0373525b3 wmllint: Recognize help_topic_text as a translatable attribute
The attribute is used in [terrain_type] and it was first implemented in
a28cfc3fd9.
2013-12-04 17:01:56 -03:00
Bär Halberkamp
ffe06509c9 Fixed wmllint with my latest commits 2013-12-04 20:29:28 +01:00
Ignacio R. Morelle
2990819325 units.w.o: Upload to baldras.w.o instead of asheviere.w.o 2013-10-07 02:32:14 -03:00
Alexander van Gessel
a922551302 Don't compare a boolean to None 2013-10-06 02:26:18 +02:00
Elvish_Hunter
257c8aec88 wmllint: implemented new sanity check for leader and nozoc ellipses 2013-09-26 21:07:08 +02:00
Elvish_Hunter
94c33bf9af wmllint: stop complaining about unknown IDs inside [clear_menu_item] 2013-09-21 10:10:50 +02:00
Andrius Silinskas
8fa57b4150 Mark "new_game_title" as translatable in wmllint.
Relevant strings were adjusted in LoW.
2013-09-20 19:14:33 +01:00
Alexander van Gessel
d8982af444 Fix a typo fix 2013-08-24 21:13:24 +02:00
Thibault Févry
a89f78f469 Fix more typos. 2013-08-24 19:28:19 +02:00
Thibault Févry
df427826fa Fix typos in terrain2wiki.py 2013-08-24 19:16:14 +02:00
Thibault Févry
98b8822ccf Fix typos in data/tools/wesnoth files. 2013-08-24 19:13:24 +02:00
Thibault Févry
8ed68f5c55 Ran reindent so we don't use tabs. 2013-08-24 18:53:46 +02:00
Thibault Févry
dee75eeef0 Fix indent. 2013-08-24 18:47:00 +02:00
Groggy Dice
d3bb951548 check for textdomain paths without '/translations', and binary paths referring to 'external' data
The convention that [textdomain] uses "/translations" is strongly established, and I can't think of a legitimate reason for an add-on not to be following it.

The binary path check is a crude test. The names that took hold for menu image directories are "/public" and variations of "/external*", so we look for those strings. It does not catch the worst case of all - when all binaries are outside the campaign define, not just a set-aside directory.

I first thought of these checks while brainstorming ways to use the in_textdomain and in_binary_path code in hack_syntax(). However, realizing that these checks did not really hack any syntax, I wanted to find someplace in the sanity checks where the code would fit. I finally found it.
2013-08-21 04:39:44 -04:00
Groggy Dice
6cf03fe827 fix wmltools' parse_attribute to not consider pango color hashes as a comment
While there are many places that wmllint assumes that "#" begins a comment, from Vultraz's description it sounded like parse_attribute was being used to find the attribute's value, and then a string_strip was done on the value. So I looked for the direct cause in wmltools.

Again, the solution is to look for whitespace to precede the hashsign.

Incidentally, I don't know why the original code had the first "where -= 1", then had value and comment go from [:where+1] and [where+1:].
2013-08-19 22:06:16 -04:00
Groggy Dice
d90f082312 wmlindent: fix pango indentation-stopping bug (pointed out by vultraz)
I had a hunch that the hash would be the problem, because I realized that wmllint usually just looked for '#' to figure out if a line contained a comment, and that this also matched pango color coding. My wmllint backslash/userdata commits used this same re.split match to prevent this false positive.

(It won't prevent all unintended matches, e.g. "Guard #4", but I don't think that can be helped.)

The problem came, I believe, when the old line interacted with the block ten lines down:

        elif eligible.count('"') % 2:
            dostrip = not dostrip

The value's closing quote was on the other side of the split.
2013-08-18 23:08:19 -04:00
Groggy Dice
8b3aba7ccb wmllint: extend scenario check to include first scenario
Some newbie authors run into trouble at this point!
2013-08-17 19:27:00 -04:00
Groggy Dice
93af90d2db additions to wmllint help
Here's the rationale for these additions:

* There is so much focus on wmllint's role in conversion, that many people may not think of it as a validator also (I didn't). So often, stumped authors ask in the forums about problems that would have been fixed or pointed out if they'd run wmllint. I want to encourage awareness of wmllint as a validator.

* Folded a line to fit normal 80-width CLI.

* Help contained no mention of this rather redundant option.

* How many people don't realize that ESR's long introduction is there?

* Some users may not understand why they're being dumped back to wmllint's help.
2013-08-17 19:26:52 -04:00
Groggy Dice
db560619e8 wmllint: add switch -K --known for suppresing consistency_check()
I used "inconsistency" for the actual variable name, because "known" seems more likely to be accidentally reused.

I pondered whether to allow the scenario check to go forward, but decided to just make a clean break.

Note that this does not prevent any of the information-gathering for the consistency check, just the check itself.

Why would you want to use this option? Of course, you should run the consistency check at some point. But if you simply want to recheck if you've fixed all the bugs in your campaign, you might not want to have wmllint slog through data/core again.
2013-08-17 19:26:44 -04:00
Groggy Dice
46e9d8dc1d wmllint: bugfix missing "stringfreeze" long argument in getopt, and correct help description
According to the introduction, stringfreeze does *not* suppress the warning, and the code bears this out.

I wonder how often this option is actually used.
2013-08-17 19:26:36 -04:00
Groggy Dice
45fa75c082 change introduction's reference to checking out wmllint from 1.4 branch, to wmllint-1.4 2013-08-17 19:26:29 -04:00
Groggy Dice
8335d131bd wmllint-1.4: revise help to reflect its current status as an adjunct to current wmllint 2013-08-15 20:43:57 -04:00
Groggy Dice
a315603d2c wmllint: bugfix "unresolved scenario" check 2013-08-15 19:20:50 -04:00
Groggy Dice
c3863ac222 implement keyword 'unwho ALL' for clearing all "wmllint: who" entries at end of campaign
I realized that as it stood, my dictionary would linger, bad if wmllint were being run on multiple campaigns. A special unwho keyword, 'all', clears the dictionary.
2013-08-15 19:13:22 -04:00