Working on a WML checker and need some info..

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
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Working on a WML checker and need some info..

Post by CIB »

I'm working on a program in Ruby that is supposed to check if tags/attributes/values are valid and some other stuff, but some things that are necessary for it I don't know.

-in which order are files loaded when a folder is loaded?
-does it make a difference if a value is enclosed by " or not? (like name=start and name="start")
-what characters are valid for tags like id?
-is there any good way to find out, what values are valid for a tag?(where could I find it in the source code if I need to?)

More (maybe) coming soon..
tashi
Posts: 49
Joined: March 2nd, 2007, 4:07 am
Location: Texas

Post by tashi »

I was just thinking about this two days ago while working in VIM. Color syntax is nice but where are my syntax bugs at, am I closing all my blocks, etc.

Good luck, I hope you reach your goal.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Re: Working on a WML checker and need some info..

Post by toms »

CIB wrote: -in which order are files loaded when a folder is loaded?
First the campaign file, then the WML files you included in the campaign file, in the order as you included them. (@all: That's all AFAIK, if wrong please correct)
-does it make a difference if a value is enclosed by " or not? (like name=start and name="start")
The quote marks set the enclosed string as the value. If a string is required as a value, you need the quote marks. Otherwise, AFAIK it doesn't matter.

The last two ones, I don't really know.
First read, then think. Read again, think again. And then post!
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Re: Working on a WML checker and need some info..

Post by meriton »

1. is answered in http://www.wesnoth.org/wiki/PreprocessorRef
2. is answered in http://www.wesnoth.org/wiki/SyntaxWML Note that tom's answer contradicts what is written there.
3. The list of tags in the WML reference does not mention a tag called id. Are you sure it exists?
4. Do you mean what attributes are valid in a tag, or what values are valid for an attribute? Either is documented in the wiki. (you know where to find the list of WML tags, don't you?) I don't know about the source code.
User avatar
Simons Mith
Posts: 821
Joined: January 27th, 2005, 10:46 pm
Location: Twickenham
Contact:

Post by Simons Mith »

Edit: The id tag is used to be used to flag important strings. You used to have things like

Code: Select all

[message]
id=scen1mess1
message="Blah blah blah"
. . .
[/message]
[message]
id=scen1mess2
message="Blah blah"
. . .
[/message]
which allowed scen1mess1 and scen1mess2 to be referenced correctly. Checking in CVS I find ID tags are used for scenarios and units but not for (e.g.) messages.

Edit: As far as enclosing strings in quotes is concerned, in addition to what toms says, it would also be needed if an entity had a space in its name. there are cases where "Skeleton" would not need quotes, but where "Skeleton Archer" used in the same place would.

Off-hand I can't think of any cases where putting unneeded quotes in actually causes problems, but I could easily have overlooked something obvious.

[Edited to remove misinformation]
Last edited by Simons Mith on June 11th, 2007, 5:42 pm, edited 2 times in total.
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Post by CIB »

First the campaign file, then the WML files you included in the campaign file, in the order as you included them. (@all: That's all AFAIK, if wrong please correct)
You can also open folders with {folder}. And what I was asking was, if there are 3 files e.g. "scenario.cfg","macro.cfg" and "units.cfg" in a folder, which will be loaded first?

id's are being used for scenarios and units for example. I'm not sure if they can include spaces and special characters, but I'm pretty sure they can't include linebreaks..
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Re: Working on a WML checker and need some info..

Post by CIB »

Oh, didn't see your post, meriton.
meriton wrote:1. is answered in http://www.wesnoth.org/wiki/PreprocessorRef
Has that information been added lately? I can't remember it being there before a few months.
3. The list of tags in the WML reference does not mention a tag called id. Are you sure it exists?
Oh, whoops! I meant attribute.
4. Do you mean what attributes are valid in a tag, or what values are valid for an attribute? Either is documented in the wiki. (you know where to find the list of WML tags, don't you?) I don't know about the source code.
Again, sorry, I meant attribute =) Well, the wiki isn't accurate enough, sometimes different attributes that should accept the same value, do not. It's good for finding out what attributes/tags a tag can contain though.
Post Reply