1928 Commits

Author SHA1 Message Date
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
Groggy Dice
a8a65c25b2 add explanation about how to use "wmllint: who" magic comments to introduction 2013-08-15 01:22:05 -04:00
Groggy Dice
ab18d94117 magic comment to remove items from whopairs dictionary
If no more scenarios will be using a macro, you can remove it from the dictionary with "unwho".
2013-08-15 01:21:46 -04:00
Groggy Dice
56be5f2f6b recognize characters from "wmllint: who" macros and append to present
Now that we see how the whopairs are recognized, we can see that the magic comment accepts a comma-separated list, for macros that deal with more than one character.

We also see that if it is necessary to remove a character who leaves the party, this can be done with another entry prefixed by double minuses.
2013-08-15 01:21:28 -04:00
Groggy Dice
21c50ccb2e create magic comment for persistent macro character recognition, "wmllint: who"
The "recognize" magic comment only covers one scenario; but what about macros that are used in many scenarios?

This new magic comment creates dictionary pairs of macros with the characters they are associated with. If this is not yet clear, hopefully the following commits will show the full picture.
2013-08-15 01:21:14 -04:00
Alexander van Gessel
abe67d8136 Merge branch 'master' of github.com:wesnoth/wesnoth-old 2013-08-09 00:20:02 +02:00
Alexander van Gessel
38b224c1ff Revert "Revert "Merge branch 'master' of github.com:wesnoth/wesnoth-old""
This reverts commit 23b72d6956e6316f8b50a6accba607f66cf197a7.
2013-08-09 00:13:46 +02:00
Thibault Févry
e825989bbe More range() genocide. 2013-08-09 00:13:03 +02:00
Thibault Févry
1dc00f0d93 More range() destruction. 2013-08-08 23:53:34 +02:00
Thibault Févry
e4a1dcdb88 More range to xrange conversion. 2013-08-08 23:46:36 +02:00
Thibault Févry
961dcb8c25 Remove useless ';' 2013-08-08 23:45:52 +02:00
Thibault Févry
b5319fa235 Use xrange instead of range. 2013-08-08 23:41:50 +02:00
Thibault Févry
e3fbfe5225 Use for i in iterable instead of for i in range(len(iterable)). Have a hard time testing it well, but it seems to not break anything. 2013-08-08 23:35:11 +02:00
Thibault Févry
5a5287b1f7 Use string formatting when possible. Can't use str.format() (although it would be easier to read since it was only added in 2.6 2013-08-08 19:21:39 +02:00
Thibault Févry
f4fc1c5912 Make pep8 happier. 2013-08-08 19:07:47 +02:00
Thibault Févry
65a14eff16 Fix indenting (again) 2013-08-08 18:56:11 +02:00
Thibault Févry
23b72d6956 Revert "Merge branch 'master' of github.com:wesnoth/wesnoth-old"
This reverts commit 5fa5c034110c3c942d299c8fd440297c89aca037, reversing
changes made to 06374c64ba00977a4f720a44108593fc43d5c787.
2013-08-08 18:50:46 +02:00
Thibault Févry
ddfc7d3282 Revert "Fix indenting."
This reverts commit ab58cc959c54461430868f31f2625c91501518ea.
2013-08-08 18:48:45 +02:00
Thibault Févry
ab58cc959c Fix indenting. 2013-08-08 18:31:47 +02:00
Thibault Févry
5fa5c03411 Merge branch 'master' of github.com:wesnoth/wesnoth-old 2013-08-08 13:18:10 +02:00
Alexander van Gessel
a678898f4c Move from optparse to argparse 2013-08-04 22:58:19 +02:00
Alexander van Gessel
2a13cfd439 Move from optparse to argparse 2013-08-04 22:54:59 +02:00
Alexander van Gessel
a89e9c4329 Move from optparse to argparse 2013-08-04 22:53:16 +02:00
Alexander van Gessel
c50aaf8025 Move from optparse to argparse 2013-08-04 22:51:18 +02:00
Alexander van Gessel
83f234f4be Move from optparse to argparse 2013-08-04 22:48:01 +02:00
Alexander van Gessel
2148f769f4 Move from optparse to argparse 2013-08-04 22:45:21 +02:00
Alexander van Gessel
b6f3f8fe35 Move from optparse to argparse 2013-08-04 22:44:15 +02:00
Alexander van Gessel
8f9861ef5e Some python syntax updates for the WML tools 2013-08-04 03:32:23 +02:00
Alexander van Gessel
f3a8d04db2 Quote the commit message when referring to it 2013-08-03 00:51:05 +02:00
Groggy Dice
9903fd227e fix <title> to only display branch directory
OK, so it turns out basename() was required after all!
2013-07-31 05:12:30 -04:00
Groggy Dice
5b45cccc79 make image_reference match jpeg as well as jpg extension 2013-07-31 01:36:09 -04:00
Groggy Dice
09073d3ff5 add a <title> to UMC listing pages
As I read it, basename() should not be required for path, and I've tested this locally.
2013-07-31 01:32:26 -04:00
Groggy Dice
a4ded295ba split my long stderr message, displaying details only if called by raw_input
Rather than overwhelming users with verbiage, I will hide most of my explanation unless it's asked for. My message is still not particularly brief, but it's no longer insanely long.
2013-07-31 00:13:17 -04:00
anonymissimus
4bf2a5c94c wmllint: revert part of commit 61648041284627e299ddf26bc601009520c5198e
groggy: The ifdef_stack = [None] assignment made wmllint crash upon nested
#if blocks. The following block of wml should suffice to let it crash. The
inner #endif deletes the data about encountered #ifs.

...
#ifver WESNOTH_VERSION >= 1.11.0
#ifhave ~add-ons/UMC_Music_Book_1/_main.cfg
[binary_path]
	path=data/add-ons/UMC_Music_Book_1
[/binary_path]
#endif
#else
#ifhave ~add-ons/UMC_Music/_main.cfg
[binary_path]
	path=data/add-ons/UMC_Music
[/binary_path]
#endif
#endif
...
2013-07-29 12:25:30 +02:00
Elvish_Hunter
3eb9299bd2 wmllint: added rule to manage recent changes to nozoc and leader ellipses 2013-07-27 17:11:39 +02:00
Alexander van Gessel
d394f27afb Some python syntax updates for the WML tools 2013-07-26 15:38:05 +02:00
Alexander van Gessel
7d9cae09be Some python syntax updates for the WML tools 2013-07-26 15:38:05 +02:00
Groggy Dice
5a0e9a8dd9 try to match sound's time key with a [frame] begin time
Rather than automatically putting the soundpath in the first frame, we collect a list of begin= keys and their locations. When it's time to convert, we check to see if any of those begin times match with the sound time, and if so, put sound in that [frame]. Only if there is no match do we default to the first frame, and we log a message noting the lack of a match.
2013-07-26 04:24:00 -04:00
Groggy Dice
4f55c4d697 preserve sound_miss value with SOUND:HIT_AND_MISS macro
Some [sound] tags include a sound_miss key as well. To preserve this data, I created two new variables to capture the sound_miss= and time= values, and use them to fill out the SOUND:HIT_AND_MISS macro. Because the macro is inserted before [frame] instead of after, 'if soundpath' needs to be moved up before the insertion so that the macro ends up under [attack_anim], rather than in the middle of [attack].
2013-07-26 04:23:52 -04:00
Groggy Dice
6c2802c952 fix use of "or" with "in lines[i]" in is_main detection
It's probably obvious what I tried to do. Unfortunately, only the first string works.

I also added another "and not" condition, to keep the same file from getting multiple entries in is_main.
2013-07-26 04:23:42 -04:00
Groggy Dice
4bfcb7fe66 move upconversion of ancient abilities ahead of lifting [frame] to fix problem of weapon specials appearing after [frame] sequence
After my last change, I noticed a puzzling failure by wmllint to convert a weapon special. This special was among some attributes that followed the [frame] sequence. It seems that Python does not wait for the earlier code block to complete before running the new one, and those lines aren't passed through the new block because they've been deleted and stashed in 'postframe'. When they're spewed back out, the new block has already passed those lines by.

I was relieved to find that this was not an issue introduced by my change, but an existing one. When I ran the original wmllint on the file, I found that the special= line got deleted, without being replaced by the [special] tags and macro. The latter is supposed to appear when wmllint hits the [/attack] tag, but never triggers because [/attack] has been changed to [/attack_anim].

Moving this code block up, so that abilities and specials are transformed before the [frame] lift (and 'postframe' stash), appeared to fix the problem. Hopefully, it won't cause a new on to show up.
2013-07-26 04:23:34 -04:00
Groggy Dice
29c9931c05 fix the lifting of attack [frame]s to [attack_anim]
This code block was actually producing some horrendous output, because key values were not reset to defaults at the closing [/attack] tag, even though many units have more than one attack. Also, the conversion was done when the first [frame] tag was encountered, although most authors put the [sound] block after [frame]s. So, what would typically happen is this:

* The first attack would be converted, usually without a soundpath. If there were any attributes after the [frame] sequence, the result would be non-functional, as the comment introducing this wmllint block warned (and wmllint would crash with an assertion error if "name=" happened to be one of them).

* Subsequent attacks would be converted, inheriting the sound and [attack_filter] from the soundpath and attackname of the *first* attack.

To fix these issues, I did the following:

* In order to do the conversion at a later stage, after the soundpath would normally have been picked up, the variable 'converting' was changed from a 0/1 value to a line index position.

* This enables the opportunity to move post-[frame] lines, for which purpose the new variables in_frame and postframe are created. When encountered, these lines are deleted and appended to postframe.

* When we get to [/attack], we still look to see if we are converting. If so, we go ahead with the replacement of lines[i], before the index position gets changed. Then we carry out the conversion that was originally carried out at the first [frame], using lines[converting] to do it at the same place.

* The lines in postframe are fed back in reverse order before the new closing [/attack] tag.

* Values are cleared to defaults, ready for the next [attack].

* It is no longer true that the frame sequence has to go last in [attack], so that part of the comment can be deleted.
2013-07-26 04:23:25 -04:00
Groggy Dice
411ec9d882 bugfix insertion of attack's description= key
First, the newline is added to "description = " rather than "new_line = ". But description was only changed if it didn't begin with a quotemark, meaning that those that *did* start with a quote weren't getting a newline.

Second, new_line was supposed to inherit indentation through "leader(syntactic)", but the line had already been stripped before "syntactic", in "fields = ".
2013-07-26 04:23:17 -04:00