1" Vim syntax file
2" Language:     WML - Website MetaLanguage
3" Maintainer:   Gerfried Fuchs <alfie@ist.org>
4" Filenames:    *.wml
5" Last Change:  07 Feb 2002
6" URL:		http://alfie.ist.org/software/vim/syntax/wml.vim
7"
8" Original Version: Craig Small <csmall@eye-net.com.au>
9
10" Comments are very welcome - but please make sure that you are commenting on
11" the latest version of this file.
12" SPAM is _NOT_ welcome - be ready to be reported!
13
14"  If you are looking for the "Wireless Markup Language" syntax file,
15"  please take a look at the wap.vim file done by Ralf Schandl, soon in a
16"  vim-package around your corner :)
17
18
19" For version 5.x: Clear all syntax items
20" For version 6.x: Quit when a syntax file was already loaded
21if version < 600
22  syn clear
23elseif exists("b:current_syntax")
24  finish
25endif
26
27
28" A lot of the web stuff looks like HTML so we load that first
29if version < 600
30  so <sfile>:p:h/html.vim
31else
32  runtime! syntax/html.vim
33endif
34unlet b:current_syntax
35
36if !exists("main_syntax")
37  let main_syntax = 'wml'
38endif
39
40" special character
41syn match wmlNextLine	"\\$"
42
43" Redfine htmlTag
44syn clear htmlTag
45syn region  htmlTag  start=+<[^/<]+ end=+>+  contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition
46
47"
48" Add in extra Arguments used by wml
49syn keyword htmlTagName contained gfont imgbg imgdot lowsrc
50syn keyword htmlTagName contained navbar:define navbar:header
51syn keyword htmlTagName contained navbar:footer navbar:prolog
52syn keyword htmlTagName contained navbar:epilog navbar:button
53syn keyword htmlTagName contained navbar:filter navbar:debug
54syn keyword htmlTagName contained navbar:render
55syn keyword htmlTagName contained preload rollover
56syn keyword htmlTagName contained space hspace vspace over
57syn keyword htmlTagName contained ps ds pi ein big sc spaced headline
58syn keyword htmlTagName contained ue subheadline zwue verbcode
59syn keyword htmlTagName contained isolatin pod sdf text url verbatim
60syn keyword htmlTagName contained xtable
61syn keyword htmlTagName contained csmap fsview import box
62syn keyword htmlTagName contained case:upper case:lower
63syn keyword htmlTagName contained grid cell info lang: logo page
64syn keyword htmlTagName contained set-var restore
65syn keyword htmlTagName contained array:push array:show set-var ifdef
66syn keyword htmlTagName contained say m4 symbol dump enter divert
67syn keyword htmlTagName contained toc
68syn keyword htmlTagName contained wml card do refresh oneevent catch spawn
69
70"
71" The wml arguments
72syn keyword htmlArg contained adjust background base bdcolor bdspace
73syn keyword htmlArg contained bdwidth complete copyright created crop
74syn keyword htmlArg contained direction description domainname eperlfilter
75syn keyword htmlArg contained file hint imgbase imgstar interchar interline
76syn keyword htmlArg contained keephr keepindex keywords layout spacing
77syn keyword htmlArg contained padding nonetscape noscale notag notypo
78syn keyword htmlArg contained onload oversrc pos select slices style
79syn keyword htmlArg contained subselected txtcol_select txtcol_normal
80syn keyword htmlArg contained txtonly via
81syn keyword htmlArg contained mode columns localsrc ordered
82
83
84" Lines starting with an # are usually comments
85syn match   wmlComment     "^\s*#.*"
86" The different exceptions to comments
87syn match   wmlSharpBang   "^#!.*"
88syn match   wmlUsed	   contained "\s\s*[A-Za-z:_-]*"
89syn match   wmlUse	   "^\s*#\s*use\s\+" contains=wmlUsed
90syn match   wmlInclude	   "^\s*#\s*include.+"
91
92syn region  wmlBody	   contained start=+<<+ end=+>>+
93
94syn match   wmlLocationId  contained "[A-Za-z]\+"
95syn region  wmlLocation    start=+<<+ end=+>>+ contains=wmlLocationId
96"syn region  wmlLocation    start=+{#+ end=+#}+ contains=wmlLocationId
97"syn region  wmlLocationed  contained start=+<<+ end=+>>+ contains=wmlLocationId
98
99syn match   wmlDivert      "\.\.[a-zA-Z_]\+>>"
100syn match   wmlDivertEnd   "<<\.\."
101" new version
102"syn match   wmlDivert      "{#[a-zA-Z_]\+#:"
103"syn match   wmlDivertEnd   ":##}"
104
105syn match   wmlDefineName  contained "\s\+[A-Za-z-]\+"
106syn region  htmlTagName    start="\<\(define-tag\|define-region\)" end="\>" contains=wmlDefineName
107
108" The perl include stuff
109if main_syntax != 'perl'
110  " Perl script
111  if version < 600
112    syn include @wmlPerlScript <sfile>:p:h/perl.vim
113  else
114    syn include @wmlPerlScript syntax/perl.vim
115  endif
116  unlet b:current_syntax
117
118  syn region perlScript   start=+<perl>+ keepend end=+</perl>+ contains=@wmlPerlScript,wmlPerlTag
119" eperl between '<:' and ':>'  -- Alfie [1999-12-26]
120  syn region perlScript   start=+<:+ keepend end=+:>+ contains=@wmlPerlScript,wmlPerlTag
121  syn match    wmlPerlTag  contained "</*perl>" contains=wmlPerlTagN
122  syn keyword  wmlPerlTagN contained perl
123
124  hi link   wmlPerlTag  htmlTag
125  hi link   wmlPerlTagN htmlStatement
126endif
127
128" verbatim tags -- don't highlight anything in between  -- Alfie [2002-02-07]
129syn region  wmlVerbatimText start=+<verbatim>+ keepend end=+</verbatim>+ contains=wmlVerbatimTag
130syn match   wmlVerbatimTag  contained "</*verbatim>" contains=wmlVerbatimTagN
131syn keyword wmlVerbatimTagN contained verbatim
132hi link     wmlVerbatimTag  htmlTag
133hi link     wmlVerbatimTagN htmlStatement
134
135if main_syntax == "html"
136  syn sync match wmlHighlight groupthere NONE "</a-zA-Z]"
137  syn sync match wmlHighlight groupthere perlScript "<perl>"
138  syn sync match wmlHighlightSkip "^.*['\"].*$"
139  syn sync minlines=10
140endif
141
142" Define the default highlighting.
143" For version 5.7 and earlier: only when not done already
144" For version 5.8 and later: only when an item doesn't have highlighting yet
145if version >= 508 || !exists("did_wml_syn_inits")
146  let did_wml_syn_inits = 1
147  if version < 508
148    let did_wml_syn_inits = 1
149    command -nargs=+ HiLink hi link <args>
150  else
151    command -nargs=+ HiLink hi def link <args>
152  endif
153
154  HiLink wmlNextLine	Special
155  HiLink wmlUse		Include
156  HiLink wmlUsed	String
157  HiLink wmlBody	Special
158  HiLink wmlDiverted	Label
159  HiLink wmlDivert	Delimiter
160  HiLink wmlDivertEnd	Delimiter
161  HiLink wmlLocationId	Label
162  HiLink wmlLocation	Delimiter
163" HiLink wmlLocationed	Delimiter
164  HiLink wmlDefineName	String
165  HiLink wmlComment	Comment
166  HiLink wmlInclude	Include
167  HiLink wmlSharpBang	PreProc
168
169  delcommand HiLink
170endif
171
172let b:current_syntax = "wml"
173