Merge branch 'MacVim'
[MacVim/KaoriYa.git] / runtime / syntax / wml.vim
blob5957930c8e8e685bc8c2e3b22d0ec6cee63ca41e
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
8 " Original Version: Craig Small <csmall@eye-net.com.au>
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!
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 :)
19 " For version 5.x: Clear all syntax items
20 " For version 6.x: Quit when a syntax file was already loaded
21 if version < 600
22   syn clear
23 elseif exists("b:current_syntax")
24   finish
25 endif
28 " A lot of the web stuff looks like HTML so we load that first
29 if version < 600
30   so <sfile>:p:h/html.vim
31 else
32   runtime! syntax/html.vim
33 endif
34 unlet b:current_syntax
36 if !exists("main_syntax")
37   let main_syntax = 'wml'
38 endif
40 " special character
41 syn match wmlNextLine   "\\$"
43 " Redfine htmlTag
44 syn clear htmlTag
45 syn region  htmlTag  start=+<[^/<]+ end=+>+  contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition
48 " Add in extra Arguments used by wml
49 syn keyword htmlTagName contained gfont imgbg imgdot lowsrc
50 syn keyword htmlTagName contained navbar:define navbar:header
51 syn keyword htmlTagName contained navbar:footer navbar:prolog
52 syn keyword htmlTagName contained navbar:epilog navbar:button
53 syn keyword htmlTagName contained navbar:filter navbar:debug
54 syn keyword htmlTagName contained navbar:render
55 syn keyword htmlTagName contained preload rollover
56 syn keyword htmlTagName contained space hspace vspace over
57 syn keyword htmlTagName contained ps ds pi ein big sc spaced headline
58 syn keyword htmlTagName contained ue subheadline zwue verbcode
59 syn keyword htmlTagName contained isolatin pod sdf text url verbatim
60 syn keyword htmlTagName contained xtable
61 syn keyword htmlTagName contained csmap fsview import box
62 syn keyword htmlTagName contained case:upper case:lower
63 syn keyword htmlTagName contained grid cell info lang: logo page
64 syn keyword htmlTagName contained set-var restore
65 syn keyword htmlTagName contained array:push array:show set-var ifdef
66 syn keyword htmlTagName contained say m4 symbol dump enter divert
67 syn keyword htmlTagName contained toc
68 syn keyword htmlTagName contained wml card do refresh oneevent catch spawn
71 " The wml arguments
72 syn keyword htmlArg contained adjust background base bdcolor bdspace
73 syn keyword htmlArg contained bdwidth complete copyright created crop
74 syn keyword htmlArg contained direction description domainname eperlfilter
75 syn keyword htmlArg contained file hint imgbase imgstar interchar interline
76 syn keyword htmlArg contained keephr keepindex keywords layout spacing
77 syn keyword htmlArg contained padding nonetscape noscale notag notypo
78 syn keyword htmlArg contained onload oversrc pos select slices style
79 syn keyword htmlArg contained subselected txtcol_select txtcol_normal
80 syn keyword htmlArg contained txtonly via
81 syn keyword htmlArg contained mode columns localsrc ordered
84 " Lines starting with an # are usually comments
85 syn match   wmlComment     "^\s*#.*"
86 " The different exceptions to comments
87 syn match   wmlSharpBang   "^#!.*"
88 syn match   wmlUsed        contained "\s\s*[A-Za-z:_-]*"
89 syn match   wmlUse         "^\s*#\s*use\s\+" contains=wmlUsed
90 syn match   wmlInclude     "^\s*#\s*include.+"
92 syn region  wmlBody        contained start=+<<+ end=+>>+
94 syn match   wmlLocationId  contained "[A-Za-z]\+"
95 syn region  wmlLocation    start=+<<+ end=+>>+ contains=wmlLocationId
96 "syn region  wmlLocation    start=+{#+ end=+#}+ contains=wmlLocationId
97 "syn region  wmlLocationed  contained start=+<<+ end=+>>+ contains=wmlLocationId
99 syn match   wmlDivert      "\.\.[a-zA-Z_]\+>>"
100 syn match   wmlDivertEnd   "<<\.\."
101 " new version
102 "syn match   wmlDivert      "{#[a-zA-Z_]\+#:"
103 "syn match   wmlDivertEnd   ":##}"
105 syn match   wmlDefineName  contained "\s\+[A-Za-z-]\+"
106 syn region  htmlTagName    start="\<\(define-tag\|define-region\)" end="\>" contains=wmlDefineName
108 " The perl include stuff
109 if 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
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
124   hi link   wmlPerlTag  htmlTag
125   hi link   wmlPerlTagN htmlStatement
126 endif
128 " verbatim tags -- don't highlight anything in between  -- Alfie [2002-02-07]
129 syn region  wmlVerbatimText start=+<verbatim>+ keepend end=+</verbatim>+ contains=wmlVerbatimTag
130 syn match   wmlVerbatimTag  contained "</*verbatim>" contains=wmlVerbatimTagN
131 syn keyword wmlVerbatimTagN contained verbatim
132 hi link     wmlVerbatimTag  htmlTag
133 hi link     wmlVerbatimTagN htmlStatement
135 if 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
140 endif
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
145 if 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
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
169   delcommand HiLink
170 endif
172 let b:current_syntax = "wml"