blob: 267889d97fe393164a29c39b41f301fca53e301e [file] [log] [blame]
Bram Moolenaarf75a9632005-09-13 21:20:47 +00001" Vim completion script
Bram Moolenaarfc1421e2006-04-20 22:17:20 +00002" Language: HTML and XHTML
Bram Moolenaarf75a9632005-09-13 21:20:47 +00003" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
Bram Moolenaar5be4cee2019-09-27 19:34:08 +02004" Last Change: 2019 Sep 27
Bram Moolenaar946e27a2014-06-25 18:50:27 +02005
6" Distinguish between HTML versions.
7" To use with other HTML versions add another "elseif" condition to match
8" proper DOCTYPE.
9function! htmlcomplete#DetectOmniFlavor()
10 if &filetype == 'xhtml'
11 let b:html_omni_flavor = 'xhtml10s'
12 else
13 let b:html_omni_flavor = 'html401t'
14 endif
15 let i = 1
16 let line = ""
17 while i < 10 && i < line("$")
18 let line = getline(i)
19 if line =~ '<!DOCTYPE.*\<DTD '
20 break
21 endif
22 let i += 1
23 endwhile
24 if line =~ '<!DOCTYPE.*\<DTD ' " doctype line found above
25 if line =~ ' HTML 3\.2'
26 let b:html_omni_flavor = 'html32'
27 elseif line =~ ' XHTML 1\.1'
28 let b:html_omni_flavor = 'xhtml11'
29 else " two-step detection with strict/frameset/transitional
30 if line =~ ' XHTML 1\.0'
31 let b:html_omni_flavor = 'xhtml10'
32 elseif line =~ ' HTML 4\.01'
33 let b:html_omni_flavor = 'html401'
34 elseif line =~ ' HTML 4.0\>'
35 let b:html_omni_flavor = 'html40'
36 endif
37 if line =~ '\<Transitional\>'
38 let b:html_omni_flavor .= 't'
39 elseif line =~ '\<Frameset\>'
40 let b:html_omni_flavor .= 'f'
41 else
42 let b:html_omni_flavor .= 's'
43 endif
44 endif
45 endif
46endfunction
Bram Moolenaarf75a9632005-09-13 21:20:47 +000047
48function! htmlcomplete#CompleteTags(findstart, base)
49 if a:findstart
50 " locate the start of the word
51 let line = getline('.')
52 let start = col('.') - 1
Bram Moolenaar28c258f2006-01-25 22:02:51 +000053 let curline = line('.')
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000054 let compl_begin = col('.') - 2
Bram Moolenaar4a85b412006-04-23 22:40:29 +000055 while start >= 0 && line[start - 1] =~ '\(\k\|[!:.-]\)'
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000056 let start -= 1
Bram Moolenaarf75a9632005-09-13 21:20:47 +000057 endwhile
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000058 " Handling of entities {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000059 if start >= 0 && line[start - 1] =~ '&'
60 let b:entitiescompl = 1
61 let b:compl_context = ''
62 return start
63 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000064 " }}}
65 " Handling of <style> tag {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000066 let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW")
67 let styleend = searchpair('<style\>', '', '<\/style\>', "nW")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000068 if stylestart != 0 && styleend != 0
Bram Moolenaar28c258f2006-01-25 22:02:51 +000069 if stylestart <= curline && styleend >= curline
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +000070 let start = col('.') - 1
71 let b:csscompl = 1
72 while start >= 0 && line[start - 1] =~ '\(\k\|-\)'
73 let start -= 1
74 endwhile
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +000075 endif
76 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000077 " }}}
78 " Handling of <script> tag {{{
Bram Moolenaarb8a7b562006-02-01 21:47:16 +000079 let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW")
80 let scriptend = searchpair('<script\>', '', '<\/script\>', "nW")
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000081 if scriptstart != 0 && scriptend != 0
Bram Moolenaarb8a7b562006-02-01 21:47:16 +000082 if scriptstart <= curline && scriptend >= curline
83 let start = col('.') - 1
84 let b:jscompl = 1
85 let b:jsrange = [scriptstart, scriptend]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +000086 while start >= 0 && line[start - 1] =~ '\k'
Bram Moolenaarb8a7b562006-02-01 21:47:16 +000087 let start -= 1
88 endwhile
Bram Moolenaar8b6144b2006-02-08 09:20:24 +000089 " We are inside of <script> tag. But we should also get contents
90 " of all linked external files and (secondary, less probably) other <script> tags
91 " This logic could possible be done in separate function - may be
92 " reused in events scripting (also with option could be reused for
93 " CSS
94 let b:js_extfiles = []
95 let l = line('.')
96 let c = col('.')
97 call cursor(1,1)
98 while search('<\@<=script\>', 'W') && line('.') <= l
99 if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
100 let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
101 if filereadable(sname)
102 let b:js_extfiles += readfile(sname)
103 endif
104 endif
105 endwhile
106 call cursor(1,1)
107 let js_scripttags = []
108 while search('<script\>', 'W') && line('.') < l
109 if matchstr(getline('.'), '<script[^>]*src') == ''
110 let js_scripttag = getline(line('.'), search('</script>', 'W'))
111 let js_scripttags += js_scripttag
112 endif
113 endwhile
114 let b:js_extfiles += js_scripttags
115 call cursor(l,c)
116 unlet! l c
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000117 endif
118 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000119 " }}}
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000120 if !exists("b:csscompl") && !exists("b:jscompl")
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000121 let b:compl_context = getline('.')[0:(compl_begin)]
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000122 if b:compl_context !~ '<[^>]*$'
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000123 " Look like we may have broken tag. Check previous lines.
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000124 let i = 1
125 while 1
126 let context_line = getline(curline-i)
127 if context_line =~ '<[^>]*$'
128 " Yep, this is this line
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000129 let context_lines = getline(curline-i, curline-1) + [b:compl_context]
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000130 let b:compl_context = join(context_lines, ' ')
131 break
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000132 elseif context_line =~ '>[^<]*$' || i == curline
133 " We are in normal tag line, no need for completion at all
134 " OR reached first line without tag at all
Bram Moolenaar28c258f2006-01-25 22:02:51 +0000135 let b:compl_context = ''
136 break
137 endif
138 let i += 1
139 endwhile
140 " Make sure we don't have counter
141 unlet! i
142 endif
Bram Moolenaar09df3122006-01-23 22:23:09 +0000143 let b:compl_context = matchstr(b:compl_context, '.*\zs<.*')
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000144
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000145 " Return proper start for on-events. Without that beginning of
146 " completion will be badly reported
147 if b:compl_context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
148 let start = col('.') - 1
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000149 while start >= 0 && line[start - 1] =~ '\k'
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000150 let start -= 1
151 endwhile
152 endif
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000153 " If b:compl_context begins with <? we are inside of PHP code. It
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000154 " wasn't closed so PHP completion passed it to HTML
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000155 if &filetype =~? 'php' && b:compl_context =~ '^<?'
156 let b:phpcompl = 1
157 let start = col('.') - 1
158 while start >= 0 && line[start - 1] =~ '[a-zA-Z_0-9\x7f-\xff$]'
159 let start -= 1
160 endwhile
161 endif
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000162 else
163 let b:compl_context = getline('.')[0:compl_begin]
164 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000165 return start
166 else
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000167 " Initialize base return lists
168 let res = []
169 let res2 = []
170 " a:base is very short - we need context
171 let context = b:compl_context
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000172 " Check if we should do CSS completion inside of <style> tag
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000173 " or JS completion inside of <script> tag or PHP completion in case of <?
174 " tag AND &ft==php
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000175 if exists("b:csscompl")
176 unlet! b:csscompl
Bram Moolenaar09df3122006-01-23 22:23:09 +0000177 let context = b:compl_context
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000178 unlet! b:compl_context
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000179 return csscomplete#CompleteCSS(0, context)
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000180 elseif exists("b:jscompl")
181 unlet! b:jscompl
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000182 return javascriptcomplete#CompleteJS(0, a:base)
Bram Moolenaare0fa5602006-03-19 22:08:37 +0000183 elseif exists("b:phpcompl")
184 unlet! b:phpcompl
185 let context = b:compl_context
186 return phpcomplete#CompletePHP(0, a:base)
Bram Moolenaar09df3122006-01-23 22:23:09 +0000187 else
188 if len(b:compl_context) == 0 && !exists("b:entitiescompl")
189 return []
190 endif
191 let context = matchstr(b:compl_context, '.\zs.*')
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000192 endif
Bram Moolenaar09df3122006-01-23 22:23:09 +0000193 unlet! b:compl_context
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000194 " Entities completion {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000195 if exists("b:entitiescompl")
196 unlet! b:entitiescompl
197
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000198 if !exists("b:html_doctype")
199 call htmlcomplete#CheckDoctype()
200 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000201 if !exists("b:html_omni")
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000202 "runtime! autoload/xml/xhtml10s.vim
203 call htmlcomplete#LoadData()
Bram Moolenaara5792f52005-11-23 21:25:05 +0000204 endif
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000205
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000206 let entities = b:html_omni['vimxmlentities']
Bram Moolenaara5792f52005-11-23 21:25:05 +0000207
Bram Moolenaar09df3122006-01-23 22:23:09 +0000208 if len(a:base) == 1
209 for m in entities
210 if m =~ '^'.a:base
211 call add(res, m.';')
212 endif
213 endfor
214 return res
215 else
216 for m in entities
217 if m =~? '^'.a:base
218 call add(res, m.';')
219 elseif m =~? a:base
220 call add(res2, m.';')
221 endif
222 endfor
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000223
Bram Moolenaar09df3122006-01-23 22:23:09 +0000224 return res + res2
225 endif
226
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000227
228 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000229 " }}}
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000230 if context =~ '>'
231 " Generally if context contains > it means we are outside of tag and
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000232 " should abandon action - with one exception: <style> span { bo
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000233 if context =~ 'style[^>]\{-}>[^<]\{-}$'
234 return csscomplete#CompleteCSS(0, context)
Bram Moolenaarb8a7b562006-02-01 21:47:16 +0000235 elseif context =~ 'script[^>]\{-}>[^<]\{-}$'
236 let b:jsrange = [line('.'), search('<\/script\>', 'nW')]
237 return javascriptcomplete#CompleteJS(0, context)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000238 else
239 return []
240 endif
241 endif
242
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000243 " If context contains > it means we are already outside of tag and we
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000244 " should abandon action
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000245 " If context contains white space it is attribute.
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000246 " It can be also value of attribute.
247 " We have to get first word to offer proper completions
Bram Moolenaar5be4cee2019-09-27 19:34:08 +0200248 if context =~ '^\s*$'
249 " empty or whitespace line
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000250 let tag = ''
251 else
252 let tag = split(context)[0]
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000253 " Detect if tag is uppercase to return in proper case,
254 " we need to make it lowercase for processing
255 if tag =~ '^[A-Z]*$'
Bram Moolenaar8424a622006-04-19 21:23:36 +0000256 let uppercase_tag = 1
257 let tag = tolower(tag)
258 else
259 let uppercase_tag = 0
260 endif
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000261 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000262 " Get last word, it should be attr name
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000263 let attr = matchstr(context, '.*\s\zs.*')
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000264 " Possible situations where any prediction would be difficult:
265 " 1. Events attributes
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000266 if context =~ '\s'
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000267 " Sort out style, class, and on* cases
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000268 if context =~? "\\(on[a-z]*\\|id\\|style\\|class\\)\\s*=\\s*[\"']"
269 " Id, class completion {{{
270 if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
271 if context =~? "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
Bram Moolenaar1e015462005-09-25 22:16:38 +0000272 let search_for = "class"
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000273 elseif context =~? "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
Bram Moolenaar1e015462005-09-25 22:16:38 +0000274 let search_for = "id"
275 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000276 " Handle class name completion
277 " 1. Find lines of <link stylesheet>
278 " 1a. Check file for @import
279 " 2. Extract filename(s?) of stylesheet,
280 call cursor(1,1)
281 let head = getline(search('<head\>'), search('<\/head>'))
282 let headjoined = join(copy(head), ' ')
283 if headjoined =~ '<style'
Bram Moolenaara5792f52005-11-23 21:25:05 +0000284 " Remove possibly confusing CSS operators
Bram Moolenaar1e015462005-09-25 22:16:38 +0000285 let stylehead = substitute(headjoined, '+>\*[,', ' ', 'g')
286 if search_for == 'class'
287 let styleheadlines = split(stylehead)
288 let headclasslines = filter(copy(styleheadlines), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'")
289 else
290 let stylesheet = split(headjoined, '[{}]')
291 " Get all lines which fit id syntax
292 let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'")
293 " Filter out possible color definitions
294 call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'")
295 " Filter out complex border definitions
296 call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'")
297 let templines = join(classlines, ' ')
298 let headclasslines = split(templines)
299 call filter(headclasslines, "v:val =~ '#[a-zA-Z0-9_-]\\+'")
300 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000301 let internal = 1
302 else
303 let internal = 0
304 endif
305 let styletable = []
306 let secimportfiles = []
307 let filestable = filter(copy(head), "v:val =~ '\\(@import\\|link.*stylesheet\\)'")
308 for line in filestable
309 if line =~ "@import"
310 let styletable += [matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze")]
311 elseif line =~ "<link"
312 let styletable += [matchstr(line, "href\\s*=\\s*[\"']\\zs\\f\\+\\ze")]
313 endif
314 endfor
Bram Moolenaar1e015462005-09-25 22:16:38 +0000315 for file in styletable
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000316 if filereadable(file)
317 let stylesheet = readfile(file)
318 let secimport = filter(copy(stylesheet), "v:val =~ '@import'")
319 if len(secimport) > 0
320 for line in secimport
Bram Moolenaar1e015462005-09-25 22:16:38 +0000321 let secfile = matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze")
322 let secfile = fnamemodify(file, ":p:h").'/'.secfile
323 let secimportfiles += [secfile]
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000324 endfor
325 endif
326 endif
327 endfor
328 let cssfiles = styletable + secimportfiles
329 let classes = []
330 for file in cssfiles
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +0200331 let classlines = []
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000332 if filereadable(file)
333 let stylesheet = readfile(file)
Bram Moolenaar1e015462005-09-25 22:16:38 +0000334 let stylefile = join(stylesheet, ' ')
335 let stylefile = substitute(stylefile, '+>\*[,', ' ', 'g')
336 if search_for == 'class'
337 let stylesheet = split(stylefile)
338 let classlines = filter(copy(stylesheet), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'")
339 else
340 let stylesheet = split(stylefile, '[{}]')
341 " Get all lines which fit id syntax
342 let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'")
343 " Filter out possible color definitions
344 call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'")
345 " Filter out complex border definitions
346 call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'")
347 let templines = join(classlines, ' ')
348 let stylelines = split(templines)
349 let classlines = filter(stylelines, "v:val =~ '#[a-zA-Z0-9_-]\\+'")
350
351 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000352 endif
353 " We gathered classes definitions from all external files
354 let classes += classlines
355 endfor
356 if internal == 1
357 let classes += headclasslines
358 endif
Bram Moolenaar1e015462005-09-25 22:16:38 +0000359
360 if search_for == 'class'
361 let elements = {}
362 for element in classes
363 if element =~ '^\.'
364 let class = matchstr(element, '^\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze')
365 let class = substitute(class, ':.*', '', '')
366 if has_key(elements, 'common')
367 let elements['common'] .= ' '.class
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000368 else
Bram Moolenaar1e015462005-09-25 22:16:38 +0000369 let elements['common'] = class
370 endif
371 else
372 let class = matchstr(element, '[a-zA-Z1-6]*\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze')
373 let tagname = tolower(matchstr(element, '[a-zA-Z1-6]*\ze.'))
374 if tagname != ''
375 if has_key(elements, tagname)
376 let elements[tagname] .= ' '.class
377 else
378 let elements[tagname] = class
379 endif
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000380 endif
381 endif
Bram Moolenaar1e015462005-09-25 22:16:38 +0000382 endfor
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000383
Bram Moolenaar1e015462005-09-25 22:16:38 +0000384 if has_key(elements, tag) && has_key(elements, 'common')
385 let values = split(elements[tag]." ".elements['common'])
386 elseif has_key(elements, tag) && !has_key(elements, 'common')
387 let values = split(elements[tag])
388 elseif !has_key(elements, tag) && has_key(elements, 'common')
389 let values = split(elements['common'])
390 else
391 return []
392 endif
393
394 elseif search_for == 'id'
395 " Find used IDs
396 " 1. Catch whole file
397 let filelines = getline(1, line('$'))
398 " 2. Find lines with possible id
399 let used_id_lines = filter(filelines, 'v:val =~ "id\\s*=\\s*[\"''][a-zA-Z0-9_-]\\+"')
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000400 " 3a. Join all filtered lines
Bram Moolenaar1e015462005-09-25 22:16:38 +0000401 let id_string = join(used_id_lines, ' ')
402 " 3b. And split them to be sure each id is in separate item
403 let id_list = split(id_string, 'id\s*=\s*')
404 " 4. Extract id values
405 let used_id = map(id_list, 'matchstr(v:val, "[\"'']\\zs[a-zA-Z0-9_-]\\+\\ze")')
406 let joined_used_id = ','.join(used_id, ',').','
407
408 let allvalues = map(classes, 'matchstr(v:val, ".*#\\zs[a-zA-Z0-9_-]\\+")')
409
410 let values = []
411
412 for element in classes
413 if joined_used_id !~ ','.element.','
414 let values += [element]
415 endif
416
417 endfor
418
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000419 endif
420
421 " We need special version of sbase
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000422 let classbase = matchstr(context, ".*[\"']")
Bram Moolenaar1e015462005-09-25 22:16:38 +0000423 let classquote = matchstr(classbase, '.$')
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000424
425 let entered_class = matchstr(attr, ".*=\\s*[\"']\\zs.*")
426
427 for m in sort(values)
428 if m =~? '^'.entered_class
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000429 call add(res, m . classquote)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000430 elseif m =~? entered_class
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000431 call add(res2, m . classquote)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000432 endif
433 endfor
434
435 return res + res2
436
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000437 elseif context =~? "style\\s*=\\s*[\"'][^\"']*$"
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000438 return csscomplete#CompleteCSS(0, context)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000439
440 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000441 " }}}
442 " Complete on-events {{{
443 if context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
444 " We have to:
445 " 1. Find external files
446 let b:js_extfiles = []
447 let l = line('.')
448 let c = col('.')
449 call cursor(1,1)
450 while search('<\@<=script\>', 'W') && line('.') <= l
451 if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
452 let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
453 if filereadable(sname)
454 let b:js_extfiles += readfile(sname)
455 endif
456 endif
457 endwhile
458 " 2. Find at least one <script> tag
459 call cursor(1,1)
460 let js_scripttags = []
461 while search('<script\>', 'W') && line('.') < l
462 if matchstr(getline('.'), '<script[^>]*src') == ''
463 let js_scripttag = getline(line('.'), search('</script>', 'W'))
464 let js_scripttags += js_scripttag
465 endif
466 endwhile
467 let b:js_extfiles += js_scripttags
468
469 " 3. Proper call for javascriptcomplete#CompleteJS
470 call cursor(l,c)
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000471 let js_context = matchstr(a:base, '\k\+$')
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000472 let js_shortcontext = substitute(a:base, js_context.'$', '', '')
473 let b:compl_context = context
474 let b:jsrange = [l, l]
475 unlet! l c
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000476 return javascriptcomplete#CompleteJS(0, js_context)
477
478 endif
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000479
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000480 " }}}
481 let stripbase = matchstr(context, ".*\\(on[a-zA-Z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*")
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000482 " Now we have context stripped from all chars up to style/class.
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000483 " It may fail with some strange style value combinations.
484 if stripbase !~ "[\"']"
485 return []
486 endif
487 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000488 " Value of attribute completion {{{
Bram Moolenaar6c391a72021-09-09 21:55:11 +0200489 " If attr contains =\s*[\"'] we match value of attribute
Bram Moolenaar8424a622006-04-19 21:23:36 +0000490 if attr =~ "=\s*[\"']" || attr =~ "=\s*$"
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000491 " Let do attribute specific completion
492 let attrname = matchstr(attr, '.*\ze\s*=')
Bram Moolenaar8424a622006-04-19 21:23:36 +0000493 let entered_value = matchstr(attr, ".*=\\s*[\"']\\?\\zs.*")
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000494 let values = []
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000495 " Load data {{{
496 if !exists("b:html_doctype")
497 call htmlcomplete#CheckDoctype()
498 endif
499 if !exists("b:html_omni")
500 "runtime! autoload/xml/xhtml10s.vim
501 call htmlcomplete#LoadData()
502 endif
503 " }}}
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000504 if attrname == 'href'
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000505 " Now we are looking for local anchors defined by name or id
506 if entered_value =~ '^#'
507 let file = join(getline(1, line('$')), ' ')
508 " Split it be sure there will be one id/name element in
509 " item, it will be also first word [a-zA-Z0-9_-] in element
510 let oneelement = split(file, "\\(meta \\)\\@<!\\(name\\|id\\)\\s*=\\s*[\"']")
511 for i in oneelement
512 let values += ['#'.matchstr(i, "^[a-zA-Z][a-zA-Z0-9%_-]*")]
513 endfor
514 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000515 else
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000516 if has_key(b:html_omni, tag) && has_key(b:html_omni[tag][1], attrname)
517 let values = b:html_omni[tag][1][attrname]
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000518 else
519 return []
520 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000521 endif
522
523 if len(values) == 0
524 return []
525 endif
526
527 " We need special version of sbase
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000528 let attrbase = matchstr(context, ".*[\"']")
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000529 let attrquote = matchstr(attrbase, '.$')
Bram Moolenaar8424a622006-04-19 21:23:36 +0000530 if attrquote !~ "['\"]"
531 let attrquoteopen = '"'
532 let attrquote = '"'
533 else
534 let attrquoteopen = ''
535 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000536
537 for m in values
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000538 " This if is needed to not offer all completions as-is
539 " alphabetically but sort them. Those beginning with entered
540 " part will be as first choices
541 if m =~ '^'.entered_value
Bram Moolenaarf9393ef2006-04-24 19:47:27 +0000542 call add(res, attrquoteopen . m . attrquote)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000543 elseif m =~ entered_value
Bram Moolenaarf9393ef2006-04-24 19:47:27 +0000544 call add(res2, attrquoteopen . m . attrquote)
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000545 endif
546 endfor
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000547
548 return res + res2
549
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000550 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000551 " }}}
552 " Attribute completion {{{
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000553 " Shorten context to not include last word
554 let sbase = matchstr(context, '.*\ze\s.*')
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000555
556 " Load data {{{
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000557 if !exists("b:html_doctype")
558 call htmlcomplete#CheckDoctype()
559 endif
560 if !exists("b:html_omni")
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000561 call htmlcomplete#LoadData()
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000562 endif
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000563 " }}}
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000564
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000565 if has_key(b:html_omni, tag)
566 let attrs = keys(b:html_omni[tag][1])
Bram Moolenaar8424a622006-04-19 21:23:36 +0000567 else
568 return []
569 endif
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000570
571 for m in sort(attrs)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000572 if m =~ '^'.attr
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000573 call add(res, m)
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000574 elseif m =~ attr
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000575 call add(res2, m)
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000576 endif
577 endfor
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000578 let menu = res + res2
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000579 if has_key(b:html_omni, 'vimxmlattrinfo')
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000580 let final_menu = []
581 for i in range(len(menu))
582 let item = menu[i]
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000583 if has_key(b:html_omni['vimxmlattrinfo'], item)
584 let m_menu = b:html_omni['vimxmlattrinfo'][item][0]
585 let m_info = b:html_omni['vimxmlattrinfo'][item][1]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000586 else
587 let m_menu = ''
588 let m_info = ''
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000589 endif
590 if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$'
591 let item = item
592 let m_menu = 'Bool'
593 else
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000594 let item .= '="'
595 endif
596 let final_menu += [{'word':item, 'menu':m_menu, 'info':m_info}]
597 endfor
598 else
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000599 let final_menu = []
600 for i in range(len(menu))
601 let item = menu[i]
602 if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$'
603 let item = item
604 else
605 let item .= '="'
606 endif
607 let final_menu += [item]
608 endfor
609 return final_menu
610
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000611 endif
612 return final_menu
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000613
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000614 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000615 " }}}
616 " Close tag {{{
Bram Moolenaar6b730e12005-09-16 21:47:57 +0000617 let b:unaryTagsStack = "base meta link hr br param img area input col"
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000618 if context =~ '^\/'
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000619 if context =~ '^\/.'
620 return []
621 else
622 let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
623 return [opentag.">"]
624 endif
Bram Moolenaar4c903f92005-09-14 21:32:32 +0000625 endif
Bram Moolenaar8424a622006-04-19 21:23:36 +0000626 " }}}
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000627 " Load data {{{
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000628 if !exists("b:html_doctype")
629 call htmlcomplete#CheckDoctype()
630 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000631 if !exists("b:html_omni")
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000632 "runtime! autoload/xml/xhtml10s.vim
633 call htmlcomplete#LoadData()
Bram Moolenaar4c903f92005-09-14 21:32:32 +0000634 endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000635 " }}}
636 " Tag completion {{{
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000637 " Deal with tag completion.
Bram Moolenaar8424a622006-04-19 21:23:36 +0000638 let opentag = tolower(xmlcomplete#GetLastOpenTag("b:unaryTagsStack"))
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000639 " MM: TODO: GLOT works always the same but with some weird situation it
640 " behaves as intended in HTML but screws in PHP
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000641 if opentag == '' || &filetype == 'php' && !has_key(b:html_omni, opentag)
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000642 " Hack for sometimes failing GetLastOpenTag.
643 " As far as I tested fail isn't GLOT fault but problem
644 " of invalid document - not properly closed tags and other mish-mash.
645 " Also when document is empty. Return list of *all* tags.
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000646 let tags = keys(b:html_omni)
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000647 call filter(tags, 'v:val !~ "^vimxml"')
648 else
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000649 if has_key(b:html_omni, opentag)
650 let tags = b:html_omni[opentag][0]
Bram Moolenaar8424a622006-04-19 21:23:36 +0000651 else
652 return []
653 endif
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000654 endif
655 " }}}
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000656
Bram Moolenaar8424a622006-04-19 21:23:36 +0000657 if exists("uppercase_tag") && uppercase_tag == 1
658 let context = tolower(context)
659 endif
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000660 " Handle XML keywords: DOCTYPE
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000661 if opentag == ''
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000662 let tags += [
Bram Moolenaard5ab34b2007-05-05 17:15:44 +0000663 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">',
664 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">',
665 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">',
666 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">',
667 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
668 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
669 \ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
670 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
671 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
672 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
673 \ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/1999/xhtml">'
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000674 \ ]
675 endif
Bram Moolenaar4c903f92005-09-14 21:32:32 +0000676
Bram Moolenaarcef9dcc2005-12-06 19:50:41 +0000677 for m in sort(tags)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000678 if m =~ '^'.context
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000679 call add(res, m)
Bram Moolenaard5cdbeb2005-10-10 20:59:28 +0000680 elseif m =~ context
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +0000681 call add(res2, m)
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000682 endif
Bram Moolenaar6b730e12005-09-16 21:47:57 +0000683 endfor
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000684 let menu = res + res2
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000685 if has_key(b:html_omni, 'vimxmltaginfo')
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000686 let final_menu = []
687 for i in range(len(menu))
688 let item = menu[i]
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000689 if has_key(b:html_omni['vimxmltaginfo'], item)
690 let m_menu = b:html_omni['vimxmltaginfo'][item][0]
691 let m_info = b:html_omni['vimxmltaginfo'][item][1]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000692 else
693 let m_menu = ''
694 let m_info = ''
695 endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000696 if &filetype == 'html' && exists("uppercase_tag") && uppercase_tag == 1 && item !~ 'DOCTYPE'
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000697 let item = toupper(item)
698 endif
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000699 if item =~ 'DOCTYPE'
700 let abbr = 'DOCTYPE '.matchstr(item, 'DTD \zsX\?HTML .\{-}\ze\/\/')
701 else
702 let abbr = item
703 endif
704 let final_menu += [{'abbr':abbr, 'word':item, 'menu':m_menu, 'info':m_info}]
Bram Moolenaar1d2ba7f2006-02-14 22:29:30 +0000705 endfor
706 else
707 let final_menu = menu
708 endif
709 return final_menu
Bram Moolenaar6b730e12005-09-16 21:47:57 +0000710
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000711 " }}}
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000712 endif
713endfunction
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000714
715function! htmlcomplete#LoadData() " {{{
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000716 if !exists("b:html_omni_flavor")
Bram Moolenaar4a85b412006-04-23 22:40:29 +0000717 if &filetype == 'html'
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000718 let b:html_omni_flavor = 'html401t'
719 else
720 let b:html_omni_flavor = 'xhtml10s'
721 endif
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000722 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000723 " With that if we still have bloated memory but create new buffer
724 " variables only by linking to existing g:variable, not sourcing whole
725 " file.
726 if exists('g:xmldata_'.b:html_omni_flavor)
727 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
728 else
729 exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim'
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000730 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000731 endif
732endfunction
733" }}}
734function! htmlcomplete#CheckDoctype() " {{{
735 if exists('b:html_omni_flavor')
736 let old_flavor = b:html_omni_flavor
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000737 else
Bram Moolenaarf193fff2006-04-27 00:02:13 +0000738 let old_flavor = ''
739 endif
740 let i = 1
741 while i < 10 && i < line("$")
742 let line = getline(i)
743 if line =~ '<!DOCTYPE.*\<DTD HTML 3\.2'
744 let b:html_omni_flavor = 'html32'
745 let b:html_doctype = 1
746 break
747 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Transitional'
748 let b:html_omni_flavor = 'html40t'
749 let b:html_doctype = 1
750 break
751 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Frameset'
752 let b:html_omni_flavor = 'html40f'
753 let b:html_doctype = 1
754 break
755 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0'
756 let b:html_omni_flavor = 'html40s'
757 let b:html_doctype = 1
758 break
759 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Transitional'
760 let b:html_omni_flavor = 'html401t'
761 let b:html_doctype = 1
762 break
763 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Frameset'
764 let b:html_omni_flavor = 'html401f'
765 let b:html_doctype = 1
766 break
767 elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01'
768 let b:html_omni_flavor = 'html401s'
769 let b:html_doctype = 1
770 break
771 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Transitional'
772 let b:html_omni_flavor = 'xhtml10t'
773 let b:html_doctype = 1
774 break
775 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Frameset'
776 let b:html_omni_flavor = 'xhtml10f'
777 let b:html_doctype = 1
778 break
779 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Strict'
780 let b:html_omni_flavor = 'xhtml10s'
781 let b:html_doctype = 1
782 break
783 elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.1'
784 let b:html_omni_flavor = 'xhtml11'
785 let b:html_doctype = 1
786 break
787 endif
788 let i += 1
789 endwhile
790 if !exists("b:html_doctype")
791 return
792 else
793 " Tie g:xmldata with b:html_omni this way we need to sourca data file only
794 " once, not every time per buffer.
795 if old_flavor == b:html_omni_flavor
796 return
797 else
798 if exists('g:xmldata_'.b:html_omni_flavor)
799 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
800 else
801 exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim'
802 exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
803 endif
804 return
805 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000806 endif
Bram Moolenaarc1e37902006-04-18 21:55:01 +0000807endfunction
808" }}}
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000809" vim:set foldmethod=marker: