Does WML support comment blocks?

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
User avatar
TheBladeRoden
Posts: 168
Joined: July 16th, 2007, 8:01 am

Does WML support comment blocks?

Post by TheBladeRoden » September 6th, 2012, 1:06 am

The "putting a # before every single line" method can get tedious after all.
Founding Father of Columbia

User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Does WML support comment blocks?

Post by 8680 » September 6th, 2012, 1:20 am

Code: Select all

#ifdef __UNUSED__
...
#endif

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Does WML support comment blocks?

Post by Sapient » September 6th, 2012, 3:33 am

I know some people used to put [comment][/comment] around a piece of WML to make it non-functional, because unrecognized tags were simply ignored.

However now it would probably trigger a warning about unrecognized WML.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
ancestral
Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Does WML support comment blocks?

Post by ancestral » September 6th, 2012, 4:53 am

Setting an unused key shouldn't trigger any kind of warning, right?

Code: Select all

comment="
  This is a comment!
  It spans multiple lines as you can see.

  That's because it's really a string. But who cares!
"
You could also define a macro called COMMENT which does nothing, or even define _, and then you can write:

Code: Select all

{_ "
  This is another comment!

  Just like the above.
"}
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer

User avatar
shadowm
Site Administrator
Posts: 6556
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Does WML support comment blocks?

Post by shadowm » September 6th, 2012, 9:02 pm

ancestral wrote:You could also define a macro called COMMENT which does nothing, or even define _
Using _ will cause wmlxgettext to see each macro substitution instance as a translatable string and waste translators’ time.
Example:
It’s really more advisable to use #ifdef with an unlikely symbol, or just make it an actual block of commented-out lines. Some editors provide functions to do the latter in a much easier fashion, e.g. Kate (the “insert smart newline” action, Shift+Enter by default).
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.

Post Reply