Syntax / Best practices guides

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
tashi
Posts: 49
Joined: March 2nd, 2007, 4:07 am
Location: Texas

Syntax / Best practices guides

Post by tashi »

Is there a best practices or syntax guides. Is there some other ref besides the wiki ref? Not all things are in the side bar. And some of them are not completely correct. For example clicking on recall takes you to statsticsWML. When I wanted something about recall in the [side] tag. Somethings have to be found by alot of digging. A list of = fields (name=, side=, gold=, etc...) would be nice too. When I played with CampGEN a ton of fields showed up that I had never seen before after setting up a scenario.

I know there is no kind of lint (c) or tidy (html) to check your syntax outside of trying to run the scenario or campaign. But it would be nice to see some consistency. There seems to be some looseness to where some things can be. Makes it a little harder to debug when examples show things in different ways.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

Actually, there is a wmllint tool and a wmlindent tool; both are stored in SVN and distributed with the development version in the tools directory

However, the ReferenceWML on the wiki is the guide, but it relies on developers and users to continuously update it. I think there is a lot of information there, so that is why you have to do a lot of digging, there's just no way around that, although maybe it could be structured better. To use your example, maybe clicking on 'recall' should take you to a disambiguation page. (The sidebar can be edited if you click 'edit' at the top of it.)
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
tashi
Posts: 49
Joined: March 2nd, 2007, 4:07 am
Location: Texas

thanks

Post by tashi »

Thanks for the information. Does those two tools only work on the 1.3.x series (and the 1.4.x by reason) or will they also work with the 1.2.x series as well.
HaJo
Inactive Developer
Posts: 174
Joined: August 7th, 2005, 11:52 pm
Location: DE

Re: thanks

Post by HaJo »

tashi wrote:Does those two tools only work on the 1.3.x series
wmllint can be used to "up-convert WML and maps between versions",
but might have problems on 1.2.x maps with custom terrains.

wmlindent just reformats wml-code without looking at the syntax.
WML has basically not changed, so it should work with any version.
-HaJo
tashi
Posts: 49
Joined: March 2nd, 2007, 4:07 am
Location: Texas

Post by tashi »

I can still see a need for checker for a particular version that determines if everything is typed in correctly and points out issues such as keys that don't do anything in particular in tag blocks.

I think the WMLlint is not a lint in the vein of the C lint which is more of a syntax checker.

It should be trival to implent a tag open/tag close checker. Matter of fact, a little add on could turn that into XML. Then plus a xls file you can get a nice little formated source file.

Sounds a reason for me to brush off some rusty skills.
User avatar
esr
Retired Developer
Posts: 228
Joined: November 26th, 2006, 6:40 pm
Location: Pennsylvania, USA
Contact:

wmllint already does tag balance checking

Post by esr »

wmlindent already does tag balance checking. There's also a tool called wmlscope that can detect unresolved references.

I wrote wmllint, wmlindent, and wmlscope. I am continuing to improve them. If you have a well-defined idea for a kind of sanity-checking they don't do, file it as a feature request for my attention.
DeadSpam
Posts: 11
Joined: December 2nd, 2007, 5:32 pm

wmlindent is missing from the /tools directory...

Post by DeadSpam »

I've looked up and down the source tree on sourceforge.net and the other site as well, and to no avail.

I just can NOT locate wmlindent, and could really use it...

Can you post wmlindent and wmllint somewhere so we can get to it?

Thanks,

Spammicus_Rex
Weeksy
Posts: 1017
Joined: January 29th, 2007, 1:05 am
Location: Oregon

Post by Weeksy »

assuming you have the dev version of wesnoth, it's under the tools directory on your computer. search for that.
DeadSpam
Posts: 11
Joined: December 2nd, 2007, 5:32 pm

Found 'em!

Post by DeadSpam »

./data/tools, not /tools.....

Spammicus_Rex
User avatar
irrevenant
Moderator Emeritus
Posts: 3692
Joined: August 15th, 2005, 7:57 am
Location: I'm all around you.

Re: Syntax / Best practices guides

Post by irrevenant »

tashi wrote:Is there a best practices or syntax guides. Is there some other ref besides the wiki ref? Not all things are in the side bar. And some of them are not completely correct.
It's a wiki. If you find a problem, please feel free to fix it.

"Unit" provides an example of how to update the sidebar to handle a WML tag that is on a couple of different pages.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Re: Syntax / Best practices guides

Post by turin »

irrevenant wrote:It's a wiki. If you find a problem, please feel free to fix it.
The issue is that if the wiki is known to not correspond with what the user knows about WML, it's unlikely to be particularly useful when trying to figure out what's going on in WML the user doesn't understand... it doesn't do a helluvalot of good to say "if you find a problem, feel free to fix it" when the whole point is that he wouldn't even know when there WAS a problem. :|
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Post Reply