WML highlighter for Notepad++
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.
WML highlighter for Notepad++
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>.
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 606 times
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...<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>
...
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.)
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.VS wrote:Maybe we can somehow integrate all these changes into new "release"? I also modified my own version a few times since then.
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.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 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 352 times
-
- userDefineLang.xml.txt
- this is my language put it into roaming/n++ ('without .txt')
- (14.45 KiB) Downloaded 462 times
Re: WML highlighter for Notepad++
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 396 times
Mica says one who cheats, cheats himself.
You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.
You are an Elvish Shyde - Beautiful, natural, and helpful, though sometimes under-appreciated.
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
Re:
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.Nyxl wrote:Currently, I've associated the .cfg extension to the "MS INI file"
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
Re: Re:
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?Viliam wrote: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.Nyxl wrote:Currently, I've associated the .cfg extension to the "MS INI file"
Re: WML highlighter for Notepad++
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.
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.
-
- Posts: 3
- Joined: May 10th, 2011, 8:29 pm
Re: WML highlighter for Notepad++
Tags with [+ break the parser. Any fixes?
Nevermind. When I added [+trait] to the keyword list, I left out the preceding space!
Nevermind. When I added [+trait] to the keyword list, I left out the preceding space!
-
- Posts: 462
- Joined: June 8th, 2006, 3:25 am
Re: WML highlighter for Notepad++
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).
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: WML highlighter for Notepad++
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:
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 162 times
-
- userDefineLang.zip
- from may 2011
- (4.21 KiB) Downloaded 279 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
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