Commit graph

1944 commits

Author SHA1 Message Date
Allefant
db98a2af1c [wmlunits] Don't store translations which are the same. 2014-01-19 21:34:26 +01:00
Allefant
e8b930260f [wmlunits] simplified dependencies 2014-01-18 16:39:36 +01:00
Allefant
0c4cd5a337 [wmlunits] implemented dependencies support 2014-01-17 18:13:45 +01:00
Groggy Dice
e059677112 wmllint: take out testing lines 2014-01-17 06:02:33 -05:00
Groggy Dice
6aa8d86b3e wmllint: recognize unstored units
This required care to:

* not add ids inside [not] tags
* remove items from dictionary not just when unstored, but when
  clear_variable is used
* handle comma-separated values
2014-01-17 05:38:44 -05:00
Groggy Dice
c7de5ce968 wmllint: lay groundwork for recognizing unstored units
The next commit will actually populate the dictionary and append
the id to recognized characters.
2014-01-17 05:38:40 -05:00
Allefant
e9430a02d1 [wmlunits] increase timeout for parsing user addons 2014-01-17 10:58:38 +01:00
Allefant
dc4670b897 [wmlunits] Don't abort un uncaught exceptions.
Instead keep going to the next addon during pre-parsing of user addons.
2014-01-16 17:45:46 +01:00
Alexander van Gessel
f9308f727d Merge branch 'wmlparser_metadata' 2014-01-15 18:02:50 +01:00
Allefant
92b02a6562 [wmlparser2] Parse multi-line WML tags.
Sigh. Probably should re-write the .plain file parser to first remove
all commands, keeping the meta-information in a separate class. Then
parse the result (which should be much simpler) and consult the
meta-information where necessary (text-domain for strings, source files
and line numbers for tokens).
2014-01-15 17:34:42 +01:00
Ignacio R. Morelle
092031e5e1 Set the executable bit on data/tools/wmllint-1.4 2014-01-12 23:40:03 -03:00
fendrin
a66a80efab Don't make assumptions on WML string value quote format. 2014-01-09 07:50:32 +01:00
Allefant
66162c1374 [wmlparser2] Fixed another newline handling case.
The last commit fixed one issue but introduced yet another. Now both
should work. Need to investigate if parsing the .plain files really is
necessary, would make things much easier if there was no need for it.
2014-01-07 15:37:36 +01:00
Ignacio R. Morelle
715618b385 wmllint: Clarify error message about existing spelling exceptions 2014-01-06 22:59:44 -03:00
Allefant
3799631bd4 [wmlparser2] Last fix introduced a different bug.
Should work properly now.
2014-01-06 00:12:14 +01:00
Alexander van Gessel
1d3e75e038 Add location metadata to wmlparser2's nodes 2014-01-05 15:09:37 +01:00
Allefant
5ad589066c [wmlparser2] Fixed issue with .plain file parsing
For example defined strings with empty lines would not work. The problem
was a direct check for newlines which failed if there were chr(254)
commands on the same line.
2014-01-04 23:54:16 +01:00
Ignacio R. Morelle
d6cfc9bb6b wmllint: Document markcheck off/on directives 2014-01-04 12:54:24 -03:00
Groggy Dice
9894a36cb6 wmllint: minor wording tweak for "unknown speaker" message 2014-01-04 09:43:54 -05:00
Groggy Dice
128958511a wmllint: prevent zero-length unit ids from crashing python-enchant spellcheck 2014-01-03 11:09:21 -05:00
Groggy Dice
9689cd0d0b wmllint: add "unknown speaker" warning
I actually thought this was already checked by the "unknown 'xx' referred to
by id" warning. Probably because many more [message]s used to use id= and
role= rather than speaker=.

As a side effect, this new error will force designers to use my 'who' and
'whofield' magic comments!
2014-01-03 10:35:31 -05:00
Groggy Dice
d580b2b476 wmltools.py: fix macro call parsing to prevent wmlscope stringliteral mismatch
I am responsible for wmlscope suddenly giving macro mismatch errors, as was
pointed out on IRC. The tell is that in each of these errors, the last field
is interpreted as a stringliteral.

An argument that starts and ends with a quote is interpreted as a stringliteral.
But under previous code, that couldn't happen: quote characters toggled the
instring status on and off, but weren't added to arg, so no arg contained any
quotes. I didn't like the fact that this stripped the quotes out of translatable
strings, so I changed the code to include quotes in arg and strip them out if
they began and ended the arg. Unfortunately, while I stripped out quotes when
arg was terminated by a space, I didn't think it was necessary when the right
bracket terminated the arg. It was.
2014-01-03 10:35:27 -05:00
Groggy Dice
20bc51302e wmllint: rewrite test of permitted tags in [part]
The tags are now tested directly, rather than as a parent of a key. The old
test was probably not missing tags like the test for illegal child of [if]
did, because [part] could be anywhere in ancestors. Anyway, [part] rarely
contains other tags.
2014-01-03 10:35:25 -05:00
Groggy Dice
b68feb74f4 wmllint: clean up detection of "illegal children of [if]"
Previously, only lines that parse_attribute could process got passed to
local_sanity_check. So tags survived as ancestors of attribute lines, but
the lines with the tags themselves got discarded. Hence, the "illegal child
of [if]" error was actually triggered by attributes, and the line number
referred to that line rather than the child tag.

While working on [aspect] and [facet] (which originally preceded this commit),
I changed the TypeError exception to pass all lines to local_sanity_check. This
allows for a direct test of the child tags. It turns out many child tags were
not tested because all the attributes were nested deeper inside other tags,
so that the child tag was not the parent of any attribute.

Two core macros failed the new test with the tags [filter_second] and
[filter_second_attack]. This pointed up the fact that these were not in the
list of valid child tags.

It also turns out that tags inside #ifdefs didn't fit the original test,
because "#ifdef" was considered an ancestor, interrupting the link between
"[if]" and the child tag.
2014-01-03 10:35:23 -05:00
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