Mediawiki markup syntax highlighting

Syntax highlighting, code folding, brace matching, code indenting, and function list

Mediawiki markup syntax highlighting

Postby Foxxen » Fri May 23, 2008 5:15 pm

Editing on UltraEdit, for use on Mediawiki, it is unformatted text, but can contain the following elements helpful for highlighting:

[[PAGENAME]] or [[PAGENAME|narrative]]
[http://url] or [http://url narrative]
<~A-Z>http://url
<~A-Z>WP:SHORTCUT<~A-Z>
<~A-Z>WT:SHORTCUT<~A-Z>

The complete list of highlighting. It is great difficulty to write a simple syntax highlighter file that'll highlight this.

The minimum to be useful:

[...] ([..] and anything inside it) and
http://... (http:// and ending with any WHITESPACE. , ; [ ] )

Would love if this can be helped!

Can someone help what a basic syntax file to handle some of these, would look like? I'm getting completely headache after the time trying to work it properly. I am sorry to ask, but it's small, I think, and I find it still unable to work out.

Until a better one arrives, I use this. Please improve?

Code: Select all
/L20"Mediawiki"
/Delimiters = !"^&* ()   -_+=.,;:'@#~[]{}?/\|
/Marker Characters = "[]{}"
/C1"Keywords"
WP
/C2"delimited text square"
[]
/C3"delimited text curly"
{}
/C4"urls"
http
ftp
mailto
/C5"url ends"
com
org
net
pdf
htm
html
php
php3
phtml
/C6"Separators"
[
]
{
}

I color /C1 = BLUE, /C2 = BLUE, /C3 = BLUE, /C4 = LIGHT BLUE + UNDERLINE, /C5= LIGHT BLUE, /C6 = BLUE

Thank you!
Foxxen
Newbie
 
Posts: 3
Joined: Fri May 23, 2008 4:55 pm

Re: Mediawiki markup syntax highlighting

Postby Mofi » Sun May 25, 2008 3:52 am

Without knowing anything about Mediawiki and it's syntax what about following syntax highlighting definition:

/L20"Mediawiki" Nocase DisableMLS Block Comment On = [ Block Comment Off = ] NestBlockComments File Extensions = TXT
/Delimiters = , ;tab<>[]{}
/Marker Characters = "<>{}"
/C1"Delimited text {}"
{}
/C2"Delimited text <>"
<>
/C4
** ftp http mailto

Note: tab must be replaced after copying it into your wordfile by a real horizontal tab (key TAB).
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Mediawiki markup syntax highlighting

Postby Foxxen » Tue May 27, 2008 12:03 pm

Following discussion with one of the guys at IDM, we now have a reasonable first stab at Mediawiki syntax marking:

Code: Select all
/L14"Mediawiki" String Chars = ¦ Line Comment =
/Delimiters = .:;/\? '"   !%&^*()-`
/Marker Characters = "[]{}=="

/C1"Keywords"
WP

/C2"delimited text square"
[]

/C3"delimited text curly"
{}

/C4"headers"
==

/C5"urls"
http
ftp
mailto

/C6"url ends"
com
org
net
pdf
htm
html
php
php3
phtml

/C7"Separators"
[
] ]]
{
}


The boldening of =..= is dodgy, since Mediawiki can contain lines with 2 or 3 or more of these in a row, whereas syntax marking expects a clear "one size fits all". But mostly, this seems to work. A problem that needed some attention was the string handling, there is an "unusual character" used to delimit strings, which was used to fix this.
Foxxen
Newbie
 
Posts: 3
Joined: Fri May 23, 2008 4:55 pm


Return to Syntax Highlighting