56 Commits

Author SHA1 Message Date
Elvish_Hunter
90919e12c6 wmllint, wmlindent, wmltools: fixed dir being used as variable name
In Python, dir is an in-built function
2015-08-05 20:38:48 +02:00
Elvish_Hunter
501b3aa2d9 wmlindent: open files as UTF-8 and use Unicode literals 2015-08-04 10:07:57 +02:00
Elvish_Hunter
0b92bcb9bc wmlindent: remove endlines which are automatically added by print() 2015-07-29 11:37:56 +02:00
Elvish_Hunter
c1643892e2 wmlindent: use print function with file= argument instead of sys.stderr.write 2015-07-29 11:33:58 +02:00
Elvish_Hunter
421a736c45 wmlindent: use print function instead of print statement
This solution has the advantage of fixing one of the most important issues when moving to Python 3.
Also, in other tools this will allow getting rid of the inconsistent usage of print>>sys.stderr/out and sys.stderr/out.write
2015-07-29 11:23:45 +02:00
Elvish_Hunter
464c3d40b3 wmlindent: use startswith()/endswith() support for tuples instead of a for cycle 2015-07-29 11:22:26 +02:00
Elvish_Hunter
07b5b4e3f3 Fixed a bug in PR #431 which broke wmlindent 2015-07-28 22:31:11 +02:00
Javier Novoa
8be183bdd9 Use with statements to open/close files on wml{indent,lint,scope}. 2015-07-27 22:15:24 -05:00
Elvish_Hunter
b6250ff165 wmlindent: check verbosity level after processing all the command line options
This fixes the same bug that Groggy Dice fixed in wmllint, and which caused -d -v to run wmlindent with a verbosity level of 2
2015-05-29 11:36:51 +02: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
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
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
Alexander van Gessel
7d9cae09be Some python syntax updates for the WML tools 2013-07-26 15:38:05 +02: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
Anonymissimus
f1a2eb07d1 Fix wmlindent writing CRLF end of lines on windows.
Its documentation says it converts to LF. Also, my wesnoth+windows
experience says it is best to use always only LF no matter what OS.
For WML at least. And I dont wanna convert back each time.
2012-01-14 17:07:58 +00:00
Thibault Févry
c408f32b5f Strip trailing whitespaces.
Some other changes to make code look more pythonish. No important changes.
2011-10-22 00:17:25 +00:00
Ignacio R. Morelle
9e94b3410c wmlindent: Update for #ifver, #ifnver 2011-03-23 03:26:58 +00:00
Ignacio R. Morelle
5341c62319 wmlindent: Update for #ifhave, #ifnhave 2011-03-23 03:20:20 +00:00
Thibault Févry
2288ef0939 Removed a lot of trailing whitespaces. Shouldn't be anymore in python scripts. 2011-03-12 02:22:21 +00:00
Alexander van Gessel
f676484395 Teach wmlindent about <<lua strings>>. 2009-07-27 01:09:42 +01:00
Eric S. Raymond
964e144790 Prevent #undef from being indented. 2009-01-05 19:01:13 +00:00
Alexander van Gessel
25c977c651 Stop wmlindent from using commented-out #enddefs. 2008-12-05 01:22:29 +01:00
Alexander van Gessel
10bc9e8733 Fix #enddef detection in wmlindent. 2008-12-03 12:24:22 +01:00
Eric S. Raymond
7df469e62e Handle macros with an #endif not at start of line. 2008-10-28 15:05:43 +00:00
Eric S. Raymond
c927cdc6e3 Preevent wmlindent from being confused by Shadowmaster's terminal frowney.
(Yes, this is a real description of a real bug...)
2008-08-30 07:34:57 +00:00
Eric S. Raymond
b31c324728 Fulfil the rest of bug #12180. Reindent appropriately. 2008-08-28 23:07:44 +00:00
Eric S. Raymond
08f09eda6f Give wmlindent a capability to declare indenters.
Pre-declare {FOREACH and {NEXT.

Write declarations in the one place they're presently needed, Sceptre of Fire.

Reindent the data tree accordingly.

This partly addresses the feature request in bug #12180.
2008-08-28 20:19:50 +00:00
Eric S. Raymond
d52a829b24 Always report changed files when reindenting. 2008-01-25 03:26:21 +00:00
Eric S. Raymond
b1b2435d40 Reindent the mainline content to uniiform whitespace. 2008-01-24 00:16:42 +00:00
Eric S. Raymond
5db1379271 Make wmlindent aware of #ifndef. 2007-11-15 13:04:02 +00:00
Eric S. Raymond
57ceb462c8 Treat [allow_undo][/allow_undo] as a no-op for indentation purposes. 2007-08-27 19:20:28 +00:00
Eric S. Raymond
0ff889e7bf Fix a reference error in wmlindent. 2007-08-01 03:31:23 +00:00
Eric S. Raymond
74b94026f7 Fix bug #4201 -- "Default Era" renamed "Era of Turmoil"
in accordance with the master history at
http://www.wesnoth.org/wiki/WesnothHistory#417-530_YW:_The_Turmoil_of_Asheviere
2007-07-26 20:12:06 +00:00
Eric S. Raymond
a3bd5f2077 Typo fix. 2007-07-25 17:26:54 +00:00
Patrick Parker
1f045db8dd make it easier to get wmlindent --help 2007-07-07 22:17:36 +00:00
Patrick Parker
e6d9458cd2 some minor fixes to wmlindent 2007-07-07 21:57:33 +00:00
Eric S. Raymond
c75c529de8 Don't ignore blank lines before a 'start ignoring' directive. 2007-06-29 12:19:05 +00:00
Eric S. Raymond
9433ae3fee Implement a facility to make wmlindent ignore designated stretches of lines.
Allow generation of XHTML docs from macro comments indented in the new format.
2007-06-29 11:50:33 +00:00
Eric S. Raymond
984971b0c3 Clean up properly in dryrun mode. 2007-06-29 11:08:13 +00:00
Eric S. Raymond
22efdacc73 Recognize --verbose. 2007-06-29 11:03:48 +00:00
Eric S. Raymond
93839b4ba9 Implemented --dryrun option. 2007-06-29 11:01:37 +00:00
Eric S. Raymond
ac9d9fdb76 Better verbosity logic. 2007-06-29 10:42:10 +00:00
Eric S. Raymond
2c5b884f91 Prevent spurious warnings on array references. 2007-06-29 10:05:21 +00:00
Eric S. Raymond
063655f003 Apply wmlindent to Son Of The Black Eye. 2007-06-29 09:07:44 +00:00
Eric S. Raymond
d714aff685 Enable wmlindent to detect multiple tags per line (which it can't handle)
and fix a .cfg not to have that glitch.
2007-06-29 09:02:17 +00:00
Eric S. Raymond
f032434e07 Expand away the last syntactically unbalanced macro in DiD. 2007-06-29 08:18:32 +00:00
Eric S. Raymond
6a8bcbec2a Don't touch the input file's timestamp if there are no changes. 2007-06-29 06:36:58 +00:00
Eric S. Raymond
20225e5ffc Canonicalize runs of blank lines. 2007-06-29 03:21:25 +00:00
Eric S. Raymond
397b350a75 Don't generate spurious trailing whitespace. 2007-06-29 01:56:20 +00:00
Eric S. Raymond
a49b2cc2b9 Suppress a spurious error message, hardwire the base indent of macros,
and fix a bug in the handling of multiline literals.
2007-06-29 01:43:03 +00:00