WML highlighter for Notepad++

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
VS
Translator
Posts: 187
Joined: November 27th, 2005, 10:07 am

WML highlighter for Notepad++

Post by VS » April 1st, 2006, 9:18 pm

If someone is interested ...

Due to implementation of custom highlighters this won't do always 100% what was intended, but the great block collapsing feature works!

Unfortunately I haven't found any way how to import/export it conveniently; you must either know a bit of XML to make it work or overwrite the original file (no problem if you didn't create your own highlighters).

So, first option is to replace the original file userDefineLang.xml - it's located in Documents and settings\YourUserName\Application data\Notepad++\ with what I posted here. The posted file has different name!

Second way is copying the part with highlighter settings from posted file to your own, and if you have at least some basic knowledge of XML (or HTML) you will soon recognize the structure - the whole part you're interested in starts with <UserLang name="wesnoth-WML" ext="cfg"> and ends with the next </UserLang>.
Attachments
userDefineLang.vs.po,wml.zip
(3.13 KiB) Downloaded 536 times

Nyxl
Posts: 25
Joined: February 12th, 2006, 6:21 pm
Contact:

Post by Nyxl » April 2nd, 2006, 8:37 am

Now that's interesting (I'm using n++ too). Currently, I've associated the .cfg extension to the "MS INI file" highlightings, which emphasizes the [tags] and the #comments. I'll give your filter a try.

Mathew
Posts: 1
Joined: April 7th, 2006, 1:17 am

Post by Mathew » April 7th, 2006, 2:13 am

Very well done. However, I did notice that a few key words were missing.
sound_miss and image_defensive come to mind immediately. Overall this works really quite well, and I am quite pleased with how it came out. This is just another reason to work with n++.

Nyxl
Posts: 25
Joined: February 12th, 2006, 6:21 pm
Contact:

Post by Nyxl » April 9th, 2006, 10:25 am

<UserLang name="wesnoth-WML" ext="cfg" commentLine="#">
<Settings>
<Global caseIgnored="no" />
<TreatAsSymbol comment="no" commentLine="yes" />
<Prefix words1="no" words2="no" words3="yes" words4="no" />
</Settings>
...
I added the bald'ed attributes to the text, and it allows the emphasizing of comment lines : it does not clash with the other #keywords, since those are defined as keywords. I'm tinkering a bit with the UserLang, adding missing keywords here and there (like #victory_when_enemies_defeated). The rest is a matter of tastes, regarding the colors and styles... :wink:

Thanks again for the contribution, VS, I find it incredibly useful.

(Note : I'll add other possible improvements in this very post whenever I find them. Only WML related stuff, no style, no color.)

VS
Translator
Posts: 187
Joined: November 27th, 2005, 10:07 am

Post by VS » April 9th, 2006, 10:38 am

Maybe we can somehow integrate all these changes into new "release"? I also modified my own version a few times since then.

BTW, WML allows [+tag] syntax, do you miss that, too? I didn't bother to rewrite all these tags with "+" in front of them...

Nyxl
Posts: 25
Joined: February 12th, 2006, 6:21 pm
Contact:

Post by Nyxl » April 9th, 2006, 12:09 pm

VS wrote:Maybe we can somehow integrate all these changes into new "release"? I also modified my own version a few times since then.
Mmh, not just yet in my opinion. I'm busy re-ordering the keywords according to their semantics (instruction, left-value names, right-value constants, tags, etc.). And by lexical ascending order, for it's not easy checking the list when the words have been obviously (and quite naturally) added when the need arised. :P
VS wrote:BTW, WML allows [+tag] syntax, do you miss that, too? I didn't bother to rewrite all these tags with "+" in front of them...
I'm content with the [+units] at the moment. I'm more interested in a thorough list of right-value constants (yes, no, on, off, moveto, start, prestart, etc.) which can add to the general readability of the code. But then, having all the +able tags on the lists can't hurt.

User avatar
Lizard
Posts: 352
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Post by Lizard » January 27th, 2008, 6:47 pm

I modified this one a bit on my own(a.e. holy -> arcan), so my version isn't compatible. I have done an Auto-completion .api for my version.
Attachments
wesnoth-WML.api.txt
The Api! just remove .txt and put into API folder
(4.53 KiB) Downloaded 273 times
userDefineLang.xml.txt
this is my language put it into roaming/n++ ('without .txt')
(14.45 KiB) Downloaded 410 times

VS
Translator
Posts: 187
Joined: November 27th, 2005, 10:07 am

Post by VS » January 27th, 2008, 8:08 pm

I just wish npp had some system that could be used for easy distribution of language definitions... because that is the reason I gave up on this. Having to manually merge files is just awkward.

User avatar
Mica
Posts: 577
Joined: December 4th, 2007, 5:18 pm

Re: WML highlighter for Notepad++

Post by Mica » August 23rd, 2008, 5:25 pm

I have added in quite a few tags, just thought I'd post it up for those that were interested.
Attachments
userDefineLang.zip
(2.13 KiB) Downloaded 323 times
Mica says one who cheats, cheats himself.

You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.

User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Re:

Post by Viliam » August 27th, 2008, 12:04 pm

Nyxl wrote:Currently, I've associated the .cfg extension to the "MS INI file"
Makes me curious... would the CFG files work correctly if we renamed them to *.WML? If yes, maybe we could start using the new extension. If no, maybe the program could be changed to accept both CFG and WML extensions. :hmm:

User avatar
Ken_Oh
Moderator Emeritus
Posts: 2176
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Re:

Post by Ken_Oh » August 27th, 2008, 12:36 pm

Viliam wrote:
Nyxl wrote:Currently, I've associated the .cfg extension to the "MS INI file"
Makes me curious... would the CFG files work correctly if we renamed them to *.WML? If yes, maybe we could start using the new extension. If no, maybe the program could be changed to accept both CFG and WML extensions. :hmm:
I don't know too much about file extensions, but, from where I'm sitting, that would make a lot of sense. Now that maps are starting to actually have an extension .map, why not .wml for those files?

AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: WML highlighter for Notepad++

Post by AI » August 27th, 2008, 1:40 pm

Though INI format consists of [tags] and keys=, it's pretty much a flat file as you close a section not with a closing tag, but by opening another.

A BBCode highlighter would probably work better...


About the extensions, when you include a directory like {@campaigns/folder/}, it includes all the files ending in .cfg, and automatically included are the files in userdata/data/campaigns and the userdata/data/campaigns/*/_main.cfg files.

However, that's the only real extension dependency that's built in, you can rename most of your files to stuff.wml and include them like {@campaigns/folder/macros/stuff.wml} and they'd work fine.

A patch to allow the .wml extension would be trivial, the question whether the behaviour is wanted.

adamsetzler
Posts: 3
Joined: May 10th, 2011, 8:29 pm

Re: WML highlighter for Notepad++

Post by adamsetzler » May 10th, 2011, 8:59 pm

Tags with [+ break the parser. Any fixes? :augh:

Nevermind. When I added [+trait] to the keyword list, I left out the preceding space!

Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: WML highlighter for Notepad++

Post by Exasperation » May 10th, 2011, 9:06 pm

You might also want to look here: http://forums.wesnoth.org/viewtopic.php?f=15&t=30411, as I believe the file at the bottom of the first post in that thread is a much more recently updated version of this (notice the posting dates in this thread).

SlowThinker
Posts: 876
Joined: November 28th, 2008, 6:18 pm

Re: WML highlighter for Notepad++

Post by SlowThinker » May 11th, 2011, 12:24 pm

userDefineLang.zip
Some time ago I integrated files of VS and skywalker (Notepad++ Syntax Highlighting) together, the result is attached.
Still the attachment misses some keywords of the Pentarctagon's file (see a link in the previous post) ... (and I am lazy to integrate again)

Edit: another file is here: http://forums.wesnoth.org/viewtopic.php ... 41#p527441
(it looks it doesn't come from any file that were posted so far)

Edit2:
userDefineLang.7z
I uploaded a new file userDefineLang.7z . It contains more WML-definitions from files that have been posted in the forums, but I never put an effort into their integration. And probably I won't do it.
the file contains these languages:
  • wesnoth-WML : it is a newer version of my file from may 2011 (skywalker+VS, then edited by myself)
  • Wesnoth-WML(Pentarctagon) : just a copy of P's file
  • wesnoth-WML-Lizard : a copy of L's file, but I removed Folder+- and replaced it by my definitions
  • Wesnoth-WML(FallenPhoenix) : a copy of FP's file
Attachments
userDefineLang.7z
from august 2014:
(10.55 KiB) Downloaded 106 times
userDefineLang.zip
from may 2011
(4.21 KiB) Downloaded 217 times
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums

Post Reply