Commit graph

1944 commits

Author SHA1 Message Date
Thibault Févry
c289f6608b Fix typos in comments 2013-07-06 04:12:05 +02:00
Thibault Févry
39e300ac72 Indicate the right wiki page in terrain2wiki.py doc and fix typos. 2013-07-06 04:07:25 +02:00
thibault
0ed4441b09 Update terrain2wiki.py to work with github transition better. Also fixing docstrings. 2013-07-03 20:21:52 +02:00
Groggy Dice
8dc3bed61f fix wmllint-crashing map_data= bug involving empty quotes
wmllint crashes if the value for the map_data key consists of unfilled quotation marks (""), just as it does if there are no quotation marks:

----
Traceback (most recent call last):
  File "data/tools/wmllint", line 1917, in translator
    outmap = [outmap[0]] + outmap + [outmap[-1]]
IndexError: list index out of range
----

This simple fix checks to make sure that there are no side-by-side quotation marks on the line.

I also tidied up a double-space two lines down.
2013-06-27 02:01:02 -04:00
Groggy Dice
419fabdad8 remove spurious string substitution from a "pango string" message
The format of this message appears to have been copied from the preceding "pango string" messages, which have a "%s" where "< or >" is. But it causes wmllint to crash with the traceback, "TypeError: not all arguments converted during string formatting".
2013-06-27 02:00:36 -04:00
Alexander van Gessel
00a2b0bbfc Merge pull request #28 from groggydice/umcpath
upgrade old UMC paths from data/campaigns/ to data/add-ons/
2013-06-22 17:44:07 -07:00
Groggy Dice
8f67d63714 increase the number of orcish warlord portrait replacements to improve variety
With three new orc alternate portraits added during 1.9, it is no longer necessary to double-up any of the substitutions for the five old-style orcish warlord portraits.

In fact, with six portraits available, one has to draw the short straw, and I chose grunt-4. I prefer grunt-5 and grunt-6, and also find them more leaderly.
2013-06-22 19:29:54 -04:00
Groggy Dice
190aedb047 tweak "dying words" error message to try to improve clarity
The existing error message is oblique enough that those developers who knew enough to understand what wmllint was driving at would normally know better than to use "die" for last words in the first place. While the message may help experienced developers porting the work of inexperienced authors, most developers getting this message are probably puzzled. A more direct message would be more likely to set newbie UMC authors on the right path.
2013-06-22 19:29:47 -04:00
Groggy Dice
9662f49066 miscellaneous spelling corrections 2013-06-22 19:29:39 -04:00
Groggy Dice
b212b94b21 convert old UMC paths from data/campaigns/ to data/add-ons/ in a mainline-safe way
Explanation:

x = 0:  Starting point of value x; will be incremented upward with each replaced path.
for dc:  With finditer, we turn up all paths in a line.
  if dc.group(1):  We want to skip campaigns that have a match in the tuple 'mainline'.
  lines[i]:  Otherwise, we reconstruct the line, substituting 'data/add-ons/' for 'data/campaigns/'. For lines where more than one path needs to be replaced, however, there is a complication. Since 'add-ons' is two characters shorter than 'campaigns', but start() and end() are based on the original location of the iteration, we have to offset start() and end() by two for each prior replacement.
  x+2:  Having made a replacement, we increment x by two.
  print:  Report the change to stdout.
2013-06-20 19:47:30 -04:00
Groggy Dice
63587d2747 add a tupled list of mainline campaigns
The next commit will use this list to keep mainline paths untouched while it updates old UMC paths from 'data/campaigns' to 'data/add-ons'.
2013-06-20 16:38:12 -04:00
Groggy Dice
3709acd107 add conversion of "~/campaigns" to "~add-ons"
grep turns up several old add-ons that use this for map_data.
2013-06-20 16:31:16 -04:00
Alexander van Gessel
79c8aa87c5 ejls's vim syntax files
Source: http://forums.wesnoth.org/viewtopic.php?p=522046#p522046
2013-06-16 19:59:03 +02:00
Alexander van Gessel
6b02a922dc Merge pull request #20 from groggydice/lint-win
convert a couple of Windows-isms (backslashes, 'userdata/') to be more x-platform friendly
2013-06-10 14:09:53 -07:00
groggydice
2167195685 append pango code to message about color spec requiring manual fix
When pangoize detects an old-style color spec, it prints a message that it needs a "manual fix." Unfortunately, the old markup used decimal values while pango uses hexadecimal, and authors were left to do the conversion themselves.

My modification not only does the hex conversion, it provides pango code ready to copy and paste into the line.

Going over this:

rgb =:  First step is to turn the original regular expression into a regex object. The one change is that later on, wmllint turns non-pango "<" and ">" into "&lt;/&gt;", so I have the regex match those too, in case we are dealing with a file that has already been through wmllint before.
if rgb:  Having turned the original search into a regex object, we are ready for an if test again.
  r, g, b =:  We need Python to recognize these strings as numbers.
  if > 255:  At least one old campaign ("A Sortie") has color specs that include values over 255. Given the impossibility of deciphering what color the author may have intended, I think the proper thing to do is to print an error pointing to the problem.
  else:  This, of course, is the normal case.
    hexed:  Here we convert our numbers to hexadecimal, and back into a string. Because numbers up to 15 will only have one hex digit and we need two, we will leave a "0" when we remove the "0x" prefix; then we take the last two characters, lopping off the zero from the numbers greater than 15 that already have two digits.
    print:  The new error message. With the regex object, we can cite the color spec specifically, not just refer to it as being "in line". And at the end is pango code, ready to copy and paste.
2013-06-06 22:42:43 -04:00
groggydice
89673c9672 regex sub to remove 'userdata/' from paths
The misguided authors who put userdata/ in their paths cause problems not just for non-Windows users, but fellow Windows users who chose not to put userdata in the install directory. This error can be removed by an approach similar to that just used to purge backslashes:

* if 'userdata': A basic filter to cut down the number of lines being run through complicated regex speeds up performance.
* while: It is possible, though rare, for a line to contain more than one path with userdata. Points about the regex: a) We continue to use precomment, though it would be well to correct commented-out old paths also, lest they mislead any more UMC writers.  b) In case you're wondering why I made one 'data/' string optional, there's a set of add-ons in 1.4 that use "userdata/campaigns" instead of "userdata/data/campaigns".  c) The '[ac]' at the end is something of an artifact of the time before I excluded comments, but it provides another safety measure insuring that the string is actually a value.
* regex object: This splits precomment into groups. Notes: a) Some authors begin with an unnecessary "../", might as well get rid of it as well. (As far as I can tell, this prefix has no effect anywhere I've seen it used, but I'd want to be positive that it ALWAYS does nothing before having wmllint replace it everywhere.) b) The first two groups have been made non-capturing; we will not need to refer to them.  c) For reporting to stdout, group(1) is extended to the next '/', though this part of the match is optional, to insure that there's no way to get trapped in a while loop.
* precomment: Here, we reconstruct precomment based on the regex object, except we simply drop what's outside group(1).
* print: In case designers don't get the point from seeing the elimination logged in stdout, I include an all-caps admonition against "userdata/". This is a really irritating bug.
* This code was inserted before the reconstruction of lines[i] from precomment and comment.
2013-06-06 19:34:07 -04:00
groggydice
8b01e0b19c code to change Windows-style backslashes in file paths to frontslashes
The task is to replace Windows backslashes in paths, without indiscriminately replacing backslashes in legitimate use as escapes (or bridge terrain).

Breaking this down:

* "no-syntax-rewrite": I don't think this is really necessary, but I will follow the practice of the hack_syntax section.
* if lines[i].lstrip().startswith("#"): Excludes lines that are only comments or defines.
* precomment: Originally, I simply excluded "#" during the while statement, but I realized that this could wrongly mistake a Pango color code (or old-style markup for green) as a comment. I now look for whitespace before "#", and rewrote this section to operate on precomment rather than the whole line.
* comment: Simply going with the second field would exclude the separator itself, so I use len.
* if '\\': Technically, this code worked going straight to the while statement, but running every line through the complicated regex made it sluggish. Faster to make sure the line meets a simple filter first.
* while: It is possible, though very uncommon, that a line could contain more than one file path. Looking at the regex test: a) Match the backslash itself, then be on the lookout for a character used to set apart a file path from other text. By excluding these, we ensure that there is an unbroken chain from the backslash to the file extension.  b) Then we have a list of file extensions, bracketed on the left by a period and the right by \b, to make sure they do not coincidentally match a string. These are the file types that might be referenced by a value (for instance, translation files are not referred to directly, so their extensions are not included). As a practical matter, EVERY instance in the wild I know of involves png, not counting one commented-out path in an ancient campaign.  c) File extensions can include capitals, particularly on Windows, where the effects of DOS unicase linger. So we make the search case-insensitive.
* regex object: This splits the line into groups. The differences from the regex used in the while statement: a) We also look for a non-pathbreaking string to the left of the backslash as well as the right. This means that group(1) will match the entire file path except the extension. b) The \b boundary has been made a non-consuming look-ahead assertion, to simplify future references to the regex object and its groups.
* fronted: The regex object, except all backslashes in group(1) are replaced by frontslashes.
* precomment: Here, we simply reconstruct precomment with the modified regex object.
* print: Besides reporting the substitution to stdout, I include a plea for cross-platform compatibility.
* lines[i]: Now it's time to rebuild the whole line.
2013-06-06 19:34:01 -04:00
groggydice
4de6d2b0af insert lstrip() into instances of 'if lines[i].startswith("#"):' in hack_syntax
Surely the intent here would also cover indented comments.
2013-06-01 23:41:15 -04:00
groggydice
c10959f8d5 remove files on Windows so --revert and second conversions can proceed
Windows won't allow a rename to overwrite an existing file (Error 183, file already exists).
2013-06-01 22:59:50 +02:00
flix/Felix Bauer
29e8584738 Add new aspect 'advancements'
As part of a GSoC proposal I added a new aspect so a scenario editor can control advancements in two ways:
1. Define a aspect with a string-value like "Swordsman, Knight", so the units of interesst will always advance to this
2. Use the LUA-Engine and return a function of the form advance(x, y) which will itself return a string-value
    like "Swordsman, Knight". Everytime a ai-unit advances advance(x, y) will be called.
The corresponding wikipage (http://wiki.wesnoth.org/AiWML) is going to be updated soon.
2013-06-01 17:21:12 +03:00
Elias Pschernig
60dbb25d5e [wmlunits] use set -e -u when running the units script 2013-05-27 23:10:47 +02:00
Allefant
d35daca000 [wmlunits] added the webserver cron script 2013-05-27 14:03:17 +02:00
Elias Pschernig
6632eaae33 [wmlunits] Fix error logging.
Now that a separate process is doing the WML parsing, need to serialize exceptions in the other process and send them to the main process to access them there.
2013-05-25 10:28:14 +02:00
Ignacio R. Morelle
96be3ead4c wmllint: Exclude preprocessor directives from [part] children check
This solves spurious errors when attempting to use #ifdef within [part].
2013-05-22 21:44:14 -04:00
Alexander van Gessel
7031646f7c Move from CIA-proxy to webhook 2013-05-10 04:45:09 +02:00
Eric S. Raymond
17414644c1 Fix up a large number of wmlscope errors created by bigmap.cfg rewrites.
Undefining and renaming library macros confuses the crap out of wmlscope,
causing many spurious messages.

This revision also normalized some line endings in files that has to be
modified anyway.
2013-03-28 00:46:14 -04:00
Alexander van Gessel (AI0867)
2561c5b28c Use sourceforge rather than GNA for terrain image URLs 2013-03-27 12:50:15 +01:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
Eric S. Raymond
7f85fa000c The git transition.
Most references to and dependencies on Subversion have been removed.
"+svn" is now "+dev". Files that can't be fixed yet have a FIXME-GIT
comment in them; most of these are in the website tests.
2013-03-26 10:44:47 -04:00
David Mikos
74f98dffad Commit alternative wmllint pattern by Soliton...
...that works without errors for new square bracket expansion
syntax. Other version was an attempt to be too simple it seems.
2013-03-24 03:45:40 +00:00
David Mikos
79330a3ae9 Apply wmllint change by Soliton to account for new square bracket expansion...
...syntax used in uniWML and elsewhere.
2013-03-24 01:13:25 +00:00
Elvish_Hunter
8200214e9b wmllint, wmlscope and wmlindent: fixed bug caused by Windows' command prompt appending double quotes to arguments 2013-02-23 13:04:12 +00:00
Elias Pschernig
0b5c23db51 [wmlunits] Fork the process before parsing each addon...
...to allow recovery from out-of-mem.
2013-02-21 14:53:13 +00:00
Ignacio R. Morelle
a3694f9b84 Revert "wmllint: ids in [time_area] are not associated to units...
...most of the time"

Done already in 2012-08-19T22:42:19Z!anonymissimus@arcor.de by anonymissimus.

This reverts commit 2013-02-19T06:44:24Z!shadowm@wesnoth.org.
2013-02-19 06:51:28 +00:00
Ignacio R. Morelle
05b12ecb69 wmllint: ids in [time_area] are not associated to units most of the time
The exception is when the [time_area] action is part of an event and
it contains an id-based SUF inside an SLF, but that should be rare
enough.
2013-02-19 06:44:24 +00:00
Alexander van Gessel
18f765246e Add an --error-log option to wescamp.py,
...which writes warnings and errors to a specified file
2013-02-12 01:15:48 +01:00
Alexander van Gessel
0f9b110d02 Check for the configuration we need and only the configuration we actually need 2013-02-12 01:15:45 +01:00
Alexander van Gessel
bf29dac1f3 Use --branch to determine addon server port if not specified 2013-02-12 01:15:43 +01:00
Alexander van Gessel
fed0af289c Add --branch option to wescamp...
...so we don't have to infer this from the wescamp checkout path
2013-02-12 01:15:40 +01:00
Alexander van Gessel
1b4c6d678a Remove old --git option from wescamp.py 2013-02-12 01:15:37 +01:00
Alexander van Gessel
370cd7ee08 Use authentication info for all github API requests if it's available 2013-02-11 02:20:35 +01:00
Ignacio R. Morelle
5f0ce8d010 Make wmllint recognize victory_string, defeat_string,
...gold_carryover_string, and notes_string (all from the [objectives]
tag) as attributes that need to be made translatable
2013-01-17 05:43:48 +00:00
Matthias Schoeck
ce6ee7e586 Rename passive_leader_shares_keep candidate action to leader_shares_keep.
This CA is on by default, dealing with a passive leader is only a
special case.  The old syntax still works for backward compatibility
(for both CA and macros).
2013-01-09 17:18:45 +00:00
Ignacio R. Morelle
30c8f93e6c website: New Year copyright update 2013-01-01 00:47:00 +00:00
Alexander van Gessel
32d65d8a4b Simplify some conditionals 2012-12-04 15:05:00 +01:00
Alexander van Gessel
f6c9df9aa7 Memoize the JSON request, not the filtering step performed on it 2012-12-04 11:18:10 +01:00
Simon Forsyth
9a83fb65c4 Add tool to remove transparent pixels from GCI 2012-12-01 18:01:09 +00:00
Anonymissimus
e18b1f75d0 fix wmllint rule for removal of [effect]unit_type/gender= 2012-11-12 22:29:34 +00:00
Alexander van Gessel
78493185b7 Memoize github repository list 2012-11-06 00:28:27 +01:00
Elias Pschernig
728f4b41cd [units.wesnoth.org] Use full locale names in language selection. 2012-11-03 20:53:06 +00:00