How to turn off auto-parantheses in [difficulty]label

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.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

How to turn off auto-parantheses in [difficulty]label

Post by WhiteWolf »

Hello,

Today I updated my campaign's difficulty descriptions from the old difficulties=, and difficulty_descriptions= to the new [difficulty] tags, due to the report of issue #3983.

However, I did notice then, that the label tag automatically adds parentheses, "()" around the text, which is not exactly optimal. I understand the reason, the usual stuff you'd write here is something along the lines of (Beginner), (Novice),... so the standard parentheses make sense.
I however wish to add a little flavour text as well, see the attached screenshot, and the parentheses look really unnecessary. Is there any way to turn them off/make them go away?
Attachments
This is the style I aim for in my add-ons, but the extra auto-included parentheses ruin it quite much :D
This is the style I aim for in my add-ons, but the extra auto-included parentheses ruin it quite much :D
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: How to turn off auto-parantheses in [difficulty]label

Post by josteph »

https://github.com/wesnoth/wesnoth/blob ... #L137-L141

You can use old_markup=yes to do this. That's not documented in https://wiki.wesnoth.org/CampaignWML, but it should be possible to have a mode where parentheses are aren't auto-added so I think we should just document it...

edit: added missing "not"
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: How to turn off auto-parantheses in [difficulty]label

Post by WhiteWolf »

Thanks, it works fine :) Added this key to the wiki then.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: How to turn off auto-parantheses in [difficulty]label

Post by josteph »

Thank you :)
User avatar
Celtic_Minstrel
Developer
Posts: 2207
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How to turn off auto-parantheses in [difficulty]label

Post by Celtic_Minstrel »

I disagree, we shouldn't document things that are intended solely as backwards compatibility. If we want to keep that feature going forward, it should be documented as a different key that makes its meaning clearer.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: How to turn off auto-parantheses in [difficulty]label

Post by josteph »

I do think we should keep that feature going forward. I don't mind documenting it under a different key, only we'll need to make the C++ accept such a key.
User avatar
Celtic_Minstrel
Developer
Posts: 2207
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How to turn off auto-parantheses in [difficulty]label

Post by Celtic_Minstrel »

Another possibility would be to just not auto-add the parentheses - with the new layout, perhaps they're not needed anymore even for standard difficulty names.

I reverted the documentation for that key, by the way. I don't think it should be put back, but perhaps it could be mentioned in passing in the documentation for the hypothetical new key.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: How to turn off auto-parantheses in [difficulty]label

Post by WhiteWolf »

Celtic_Minstrel wrote: March 23rd, 2019, 12:40 am Another possibility would be to just not auto-add the parentheses
I'm a fan of that - if the house-style maintains parantheses or if someone wants them, it's not that difficult to include it into their description text in the first place :mrgreen: While letting people omit it is cool. :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: How to turn off auto-parantheses in [difficulty]label

Post by josteph »

Yeah, the code adds <small> unconditionally, so maybe we should just remove the parentheses altogether? Small print and parentheses is redundant. I guess we can even do that for 1.14.7, even if that would break addons that embed valid Lisp programs in the difficulty descriptions... :mrgreen:
Shiki
Developer
Posts: 348
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: How to turn off auto-parantheses in [difficulty]label

Post by Shiki »

Actually. I think your screenshot above looks quite neat.
Try out the dark board theme.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: How to turn off auto-parantheses in [difficulty]label

Post by WhiteWolf »

Shiki wrote: March 24th, 2019, 7:34 pm Actually. I think your screenshot above looks quite neat.
This is what I prefer:
Screenshot at 2019-03-25 20-04-17.png
Screenshot at 2019-03-25 20-04-17.png (160.55 KiB) Viewed 2457 times
But then again, it's a matter of personal preference. So yes, removing auto-parantheses (and the auto-grey text as well...?) would be cool :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Shiki
Developer
Posts: 348
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: How to turn off auto-parantheses in [difficulty]label

Post by Shiki »

I see, that's neater
Try out the dark board theme.
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: How to turn off auto-parantheses in [difficulty]label

Post by josteph »

Implemented in c44aa311587ef5a5e57150226b10d03d432e147d and documented.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: How to turn off auto-parantheses in [difficulty]label

Post by WhiteWolf »

Awesome, thank you :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: How to turn off auto-parantheses in [difficulty]label

Post by WhiteWolf »

Double post, for there is another issue with this :) At the moment, still using 1.14.5 with old_markup=yes, which makes the description look like the screenshot some posts ago, so without parentheses.
However, in the load game menu, the difficulty description is still shown with parentheses (no grey text though... :hmm: ). It doesn't look that odd here, however, it's strange that the markup key is ignored here.
Screenshot at 2019-04-02 20-12-39.png
Will auto_markup in 1.15 affect this text in the load game menu as well? I think it would be great if the two were linked, so the key would set both to the same markup.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Post Reply