| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | " Vim completion script | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | " Language:	HTML and XHTML | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | " Maintainer:	Mikolaj Machowski ( mikmach AT wp DOT pl ) | 
					
						
							| 
									
										
										
										
											2011-04-28 19:02:44 +02:00
										 |  |  | " Last Change:	2011 Apr 28 | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | function! htmlcomplete#CompleteTags(findstart, base) | 
					
						
							|  |  |  |   if a:findstart | 
					
						
							|  |  |  |     " locate the start of the word | 
					
						
							|  |  |  |     let line = getline('.') | 
					
						
							|  |  |  |     let start = col('.') - 1 | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 	let curline = line('.') | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	let compl_begin = col('.') - 2 | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  |     while start >= 0 && line[start - 1] =~ '\(\k\|[!:.-]\)' | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 		let start -= 1 | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  |     endwhile | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" Handling of entities {{{ | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	if start >= 0 && line[start - 1] =~ '&' | 
					
						
							|  |  |  | 		let b:entitiescompl = 1 | 
					
						
							|  |  |  | 		let b:compl_context = '' | 
					
						
							|  |  |  | 		return start | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" }}} | 
					
						
							|  |  |  | 	" Handling of <style> tag {{{ | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW") | 
					
						
							|  |  |  | 	let styleend   = searchpair('<style\>', '', '<\/style\>', "nW") | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 	if stylestart != 0 && styleend != 0 | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 		if stylestart <= curline && styleend >= curline | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 			let start = col('.') - 1 | 
					
						
							|  |  |  | 			let b:csscompl = 1 | 
					
						
							|  |  |  | 			while start >= 0 && line[start - 1] =~ '\(\k\|-\)' | 
					
						
							|  |  |  | 				let start -= 1 | 
					
						
							|  |  |  | 			endwhile | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 		endif | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" }}} | 
					
						
							|  |  |  | 	" Handling of <script> tag {{{ | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | 	let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW") | 
					
						
							|  |  |  | 	let scriptend   = searchpair('<script\>', '', '<\/script\>', "nW") | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 	if scriptstart != 0 && scriptend != 0 | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | 		if scriptstart <= curline && scriptend >= curline | 
					
						
							|  |  |  | 			let start = col('.') - 1 | 
					
						
							|  |  |  | 			let b:jscompl = 1 | 
					
						
							|  |  |  | 			let b:jsrange = [scriptstart, scriptend] | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 			while start >= 0 && line[start - 1] =~ '\k' | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | 				let start -= 1 | 
					
						
							|  |  |  | 			endwhile | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 			" We are inside of <script> tag. But we should also get contents | 
					
						
							|  |  |  | 			" of all linked external files and (secondary, less probably) other <script> tags | 
					
						
							|  |  |  | 			" This logic could possible be done in separate function - may be | 
					
						
							|  |  |  | 			" reused in events scripting (also with option could be reused for | 
					
						
							|  |  |  | 			" CSS | 
					
						
							|  |  |  | 			let b:js_extfiles = [] | 
					
						
							|  |  |  | 			let l = line('.') | 
					
						
							|  |  |  | 			let c = col('.') | 
					
						
							|  |  |  | 			call cursor(1,1) | 
					
						
							|  |  |  | 			while search('<\@<=script\>', 'W') && line('.') <= l | 
					
						
							|  |  |  | 				if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment' | 
					
						
							|  |  |  | 					let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1') | 
					
						
							|  |  |  | 					if filereadable(sname) | 
					
						
							|  |  |  | 						let b:js_extfiles += readfile(sname) | 
					
						
							|  |  |  | 					endif | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 			endwhile | 
					
						
							|  |  |  | 			call cursor(1,1) | 
					
						
							|  |  |  | 			let js_scripttags = [] | 
					
						
							|  |  |  | 			while search('<script\>', 'W') && line('.') < l | 
					
						
							|  |  |  | 				if matchstr(getline('.'), '<script[^>]*src') == '' | 
					
						
							|  |  |  | 					let js_scripttag = getline(line('.'), search('</script>', 'W')) | 
					
						
							|  |  |  | 					let js_scripttags += js_scripttag | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 			endwhile | 
					
						
							|  |  |  | 			let b:js_extfiles += js_scripttags | 
					
						
							|  |  |  | 			call cursor(l,c) | 
					
						
							|  |  |  | 			unlet! l c | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | 		endif | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" }}} | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | 	if !exists("b:csscompl") && !exists("b:jscompl") | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 		let b:compl_context = getline('.')[0:(compl_begin)] | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 		if b:compl_context !~ '<[^>]*$' | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 			" Look like we may have broken tag. Check previous lines. | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 			let i = 1 | 
					
						
							|  |  |  | 			while 1 | 
					
						
							|  |  |  | 				let context_line = getline(curline-i) | 
					
						
							|  |  |  | 				if context_line =~ '<[^>]*$' | 
					
						
							|  |  |  | 					" Yep, this is this line | 
					
						
							| 
									
										
										
										
											2007-05-05 17:15:44 +00:00
										 |  |  | 					let context_lines = getline(curline-i, curline-1) + [b:compl_context] | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 					let b:compl_context = join(context_lines, ' ') | 
					
						
							|  |  |  | 					break | 
					
						
							| 
									
										
										
										
											2006-03-19 22:08:37 +00:00
										 |  |  | 				elseif context_line =~ '>[^<]*$' || i == curline | 
					
						
							|  |  |  | 					" We are in normal tag line, no need for completion at all | 
					
						
							|  |  |  | 					" OR reached first line without tag at all | 
					
						
							| 
									
										
										
										
											2006-01-25 22:02:51 +00:00
										 |  |  | 					let b:compl_context = '' | 
					
						
							|  |  |  | 					break | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 				let i += 1 | 
					
						
							|  |  |  | 			endwhile | 
					
						
							|  |  |  | 			" Make sure we don't have counter | 
					
						
							|  |  |  | 			unlet! i | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-01-23 22:23:09 +00:00
										 |  |  | 		let b:compl_context = matchstr(b:compl_context, '.*\zs<.*') | 
					
						
							| 
									
										
										
										
											2006-03-19 22:08:37 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 		" Return proper start for on-events. Without that beginning of | 
					
						
							|  |  |  | 		" completion will be badly reported | 
					
						
							|  |  |  | 		if b:compl_context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$' | 
					
						
							|  |  |  | 			let start = col('.') - 1 | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 			while start >= 0 && line[start - 1] =~ '\k' | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 				let start -= 1 | 
					
						
							|  |  |  | 			endwhile | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-03-19 22:08:37 +00:00
										 |  |  | 		" If b:compl_context begins with <? we are inside of PHP code. It | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 		" wasn't closed so PHP completion passed it to HTML | 
					
						
							| 
									
										
										
										
											2006-03-19 22:08:37 +00:00
										 |  |  | 		if &filetype =~? 'php' && b:compl_context =~ '^<?' | 
					
						
							|  |  |  | 			let b:phpcompl = 1 | 
					
						
							|  |  |  | 			let start = col('.') - 1 | 
					
						
							|  |  |  | 			while start >= 0 && line[start - 1] =~ '[a-zA-Z_0-9\x7f-\xff$]' | 
					
						
							|  |  |  | 				let start -= 1 | 
					
						
							|  |  |  | 			endwhile | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		let b:compl_context = getline('.')[0:compl_begin] | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  |     return start | 
					
						
							|  |  |  |   else | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	" Initialize base return lists | 
					
						
							|  |  |  |     let res = [] | 
					
						
							|  |  |  |     let res2 = [] | 
					
						
							|  |  |  | 	" a:base is very short - we need context | 
					
						
							|  |  |  | 	let context = b:compl_context | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 	" Check if we should do CSS completion inside of <style> tag | 
					
						
							| 
									
										
										
										
											2006-03-19 22:08:37 +00:00
										 |  |  | 	" or JS completion inside of <script> tag or PHP completion in case of <? | 
					
						
							|  |  |  | 	" tag AND &ft==php | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 	if exists("b:csscompl") | 
					
						
							|  |  |  | 		unlet! b:csscompl | 
					
						
							| 
									
										
										
										
											2006-01-23 22:23:09 +00:00
										 |  |  | 		let context = b:compl_context | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 		unlet! b:compl_context | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 		return csscomplete#CompleteCSS(0, context) | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | 	elseif exists("b:jscompl") | 
					
						
							|  |  |  | 		unlet! b:jscompl | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 		return javascriptcomplete#CompleteJS(0, a:base) | 
					
						
							| 
									
										
										
										
											2006-03-19 22:08:37 +00:00
										 |  |  | 	elseif exists("b:phpcompl") | 
					
						
							|  |  |  | 		unlet! b:phpcompl | 
					
						
							|  |  |  | 		let context = b:compl_context | 
					
						
							|  |  |  | 		return phpcomplete#CompletePHP(0, a:base) | 
					
						
							| 
									
										
										
										
											2006-01-23 22:23:09 +00:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		if len(b:compl_context) == 0 && !exists("b:entitiescompl") | 
					
						
							|  |  |  | 			return [] | 
					
						
							|  |  |  | 		endif | 
					
						
							|  |  |  | 		let context = matchstr(b:compl_context, '.\zs.*') | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-01-23 22:23:09 +00:00
										 |  |  | 	unlet! b:compl_context | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" Entities completion {{{ | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	if exists("b:entitiescompl") | 
					
						
							|  |  |  | 		unlet! b:entitiescompl | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 		if !exists("b:html_doctype") | 
					
						
							|  |  |  | 			call htmlcomplete#CheckDoctype() | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 		if !exists("b:html_omni") | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 			"runtime! autoload/xml/xhtml10s.vim | 
					
						
							|  |  |  | 			call htmlcomplete#LoadData() | 
					
						
							| 
									
										
										
										
											2005-11-23 21:25:05 +00:00
										 |  |  | 		endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	    let entities =  b:html_omni['vimxmlentities'] | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-23 22:23:09 +00:00
										 |  |  | 		if len(a:base) == 1 | 
					
						
							|  |  |  | 			for m in entities | 
					
						
							|  |  |  | 				if m =~ '^'.a:base | 
					
						
							|  |  |  | 					call add(res, m.';') | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 			endfor | 
					
						
							|  |  |  | 			return res | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			for m in entities | 
					
						
							|  |  |  | 				if m =~? '^'.a:base | 
					
						
							|  |  |  | 					call add(res, m.';') | 
					
						
							|  |  |  | 				elseif m =~? a:base | 
					
						
							|  |  |  | 					call add(res2, m.';') | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 			endfor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			return res + res2 | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" }}} | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	if context =~ '>' | 
					
						
							|  |  |  | 		" Generally if context contains > it means we are outside of tag and | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 		" should abandon action - with one exception: <style> span { bo | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 		if context =~ 'style[^>]\{-}>[^<]\{-}$' | 
					
						
							|  |  |  | 			return csscomplete#CompleteCSS(0, context) | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | 		elseif context =~ 'script[^>]\{-}>[^<]\{-}$' | 
					
						
							|  |  |  | 			let b:jsrange = [line('.'), search('<\/script\>', 'nW')] | 
					
						
							|  |  |  | 			return javascriptcomplete#CompleteJS(0, context) | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 		else | 
					
						
							|  |  |  | 			return [] | 
					
						
							|  |  |  | 		endif | 
					
						
							|  |  |  | 	endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	" If context contains > it means we are already outside of tag and we | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 	" should abandon action | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 	" If context contains white space it is attribute. | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" It can be also value of attribute. | 
					
						
							|  |  |  | 	" We have to get first word to offer proper completions | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	if context == '' | 
					
						
							|  |  |  | 		let tag = '' | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		let tag = split(context)[0] | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  | 		" Detect if tag is uppercase to return in proper case, | 
					
						
							|  |  |  | 		" we need to make it lowercase for processing | 
					
						
							|  |  |  | 		if tag =~ '^[A-Z]*$' | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 			let uppercase_tag = 1 | 
					
						
							|  |  |  | 			let tag = tolower(tag) | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			let uppercase_tag = 0 | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 	" Get last word, it should be attr name | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	let attr = matchstr(context, '.*\s\zs.*') | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 	" Possible situations where any prediction would be difficult: | 
					
						
							|  |  |  | 	" 1. Events attributes | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	if context =~ '\s' | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 		" Sort out style, class, and on* cases | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 		if context =~? "\\(on[a-z]*\\|id\\|style\\|class\\)\\s*=\\s*[\"']" | 
					
						
							|  |  |  | 			" Id, class completion {{{ | 
					
						
							|  |  |  | 			if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$" | 
					
						
							|  |  |  | 				if context =~? "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$" | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 					let search_for = "class" | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 				elseif context =~? "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$" | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 					let search_for = "id" | 
					
						
							|  |  |  | 				endif | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 				" Handle class name completion | 
					
						
							|  |  |  | 				" 1. Find lines of <link stylesheet> | 
					
						
							|  |  |  | 				" 1a. Check file for @import | 
					
						
							|  |  |  | 				" 2. Extract filename(s?) of stylesheet, | 
					
						
							|  |  |  | 				call cursor(1,1) | 
					
						
							|  |  |  | 				let head = getline(search('<head\>'), search('<\/head>')) | 
					
						
							|  |  |  | 				let headjoined = join(copy(head), ' ') | 
					
						
							|  |  |  | 				if headjoined =~ '<style' | 
					
						
							| 
									
										
										
										
											2005-11-23 21:25:05 +00:00
										 |  |  | 					" Remove possibly confusing CSS operators | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 					let stylehead = substitute(headjoined, '+>\*[,', ' ', 'g') | 
					
						
							|  |  |  | 					if search_for == 'class' | 
					
						
							|  |  |  | 						let styleheadlines = split(stylehead) | 
					
						
							|  |  |  | 						let headclasslines = filter(copy(styleheadlines), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 					else | 
					
						
							|  |  |  | 						let stylesheet = split(headjoined, '[{}]') | 
					
						
							|  |  |  | 						" Get all lines which fit id syntax | 
					
						
							|  |  |  | 						let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 						" Filter out possible color definitions | 
					
						
							|  |  |  | 						call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 						" Filter out complex border definitions | 
					
						
							|  |  |  | 						call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 						let templines = join(classlines, ' ') | 
					
						
							|  |  |  | 						let headclasslines = split(templines) | 
					
						
							|  |  |  | 						call filter(headclasslines, "v:val =~ '#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 					endif | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 					let internal = 1 | 
					
						
							|  |  |  | 				else | 
					
						
							|  |  |  | 					let internal = 0 | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 				let styletable = [] | 
					
						
							|  |  |  | 				let secimportfiles = [] | 
					
						
							|  |  |  | 				let filestable = filter(copy(head), "v:val =~ '\\(@import\\|link.*stylesheet\\)'") | 
					
						
							|  |  |  | 				for line in filestable | 
					
						
							|  |  |  | 					if line =~ "@import" | 
					
						
							|  |  |  | 						let styletable += [matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze")] | 
					
						
							|  |  |  | 					elseif line =~ "<link" | 
					
						
							|  |  |  | 						let styletable += [matchstr(line, "href\\s*=\\s*[\"']\\zs\\f\\+\\ze")] | 
					
						
							|  |  |  | 					endif | 
					
						
							|  |  |  | 				endfor | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 				for file in styletable | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 					if filereadable(file) | 
					
						
							|  |  |  | 						let stylesheet = readfile(file) | 
					
						
							|  |  |  | 						let secimport = filter(copy(stylesheet), "v:val =~ '@import'") | 
					
						
							|  |  |  | 						if len(secimport) > 0 | 
					
						
							|  |  |  | 							for line in secimport | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 								let secfile = matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze") | 
					
						
							|  |  |  | 								let secfile = fnamemodify(file, ":p:h").'/'.secfile | 
					
						
							|  |  |  | 								let secimportfiles += [secfile] | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 							endfor | 
					
						
							|  |  |  | 						endif | 
					
						
							|  |  |  | 					endif | 
					
						
							|  |  |  | 				endfor | 
					
						
							|  |  |  | 				let cssfiles = styletable + secimportfiles | 
					
						
							|  |  |  | 				let classes = [] | 
					
						
							|  |  |  | 				for file in cssfiles | 
					
						
							| 
									
										
										
										
											2011-04-28 19:02:44 +02:00
										 |  |  | 				  	let classlines = [] | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 					if filereadable(file) | 
					
						
							|  |  |  | 						let stylesheet = readfile(file) | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 						let stylefile = join(stylesheet, ' ') | 
					
						
							|  |  |  | 						let stylefile = substitute(stylefile, '+>\*[,', ' ', 'g') | 
					
						
							|  |  |  | 						if search_for == 'class' | 
					
						
							|  |  |  | 							let stylesheet = split(stylefile) | 
					
						
							|  |  |  | 							let classlines = filter(copy(stylesheet), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 						else | 
					
						
							|  |  |  | 							let stylesheet = split(stylefile, '[{}]') | 
					
						
							|  |  |  | 							" Get all lines which fit id syntax | 
					
						
							|  |  |  | 							let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 							" Filter out possible color definitions | 
					
						
							|  |  |  | 							call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 							" Filter out complex border definitions | 
					
						
							|  |  |  | 							call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 							let templines = join(classlines, ' ') | 
					
						
							|  |  |  | 							let stylelines = split(templines) | 
					
						
							|  |  |  | 							let classlines = filter(stylelines, "v:val =~ '#[a-zA-Z0-9_-]\\+'") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						endif | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 					endif | 
					
						
							|  |  |  | 					" We gathered classes definitions from all external files | 
					
						
							|  |  |  | 					let classes += classlines | 
					
						
							|  |  |  | 				endfor | 
					
						
							|  |  |  | 				if internal == 1 | 
					
						
							|  |  |  | 					let classes += headclasslines | 
					
						
							|  |  |  | 				endif | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				if search_for == 'class' | 
					
						
							|  |  |  | 					let elements = {} | 
					
						
							|  |  |  | 					for element in classes | 
					
						
							|  |  |  | 						if element =~ '^\.' | 
					
						
							|  |  |  | 							let class = matchstr(element, '^\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze') | 
					
						
							|  |  |  | 							let class = substitute(class, ':.*', '', '') | 
					
						
							|  |  |  | 							if has_key(elements, 'common') | 
					
						
							|  |  |  | 								let elements['common'] .= ' '.class | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 							else | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 								let elements['common'] = class | 
					
						
							|  |  |  | 							endif | 
					
						
							|  |  |  | 						else | 
					
						
							|  |  |  | 							let class = matchstr(element, '[a-zA-Z1-6]*\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze') | 
					
						
							|  |  |  | 							let tagname = tolower(matchstr(element, '[a-zA-Z1-6]*\ze.')) | 
					
						
							|  |  |  | 							if tagname != '' | 
					
						
							|  |  |  | 								if has_key(elements, tagname) | 
					
						
							|  |  |  | 									let elements[tagname] .= ' '.class | 
					
						
							|  |  |  | 								else | 
					
						
							|  |  |  | 									let elements[tagname] = class | 
					
						
							|  |  |  | 								endif | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 							endif | 
					
						
							|  |  |  | 						endif | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 					endfor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					if has_key(elements, tag) && has_key(elements, 'common') | 
					
						
							|  |  |  | 						let values = split(elements[tag]." ".elements['common']) | 
					
						
							|  |  |  | 					elseif has_key(elements, tag) && !has_key(elements, 'common') | 
					
						
							|  |  |  | 						let values = split(elements[tag]) | 
					
						
							|  |  |  | 					elseif !has_key(elements, tag) && has_key(elements, 'common') | 
					
						
							|  |  |  | 						let values = split(elements['common']) | 
					
						
							|  |  |  | 					else | 
					
						
							|  |  |  | 						return [] | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 					endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 				elseif search_for == 'id' | 
					
						
							|  |  |  | 					" Find used IDs | 
					
						
							|  |  |  | 					" 1. Catch whole file | 
					
						
							|  |  |  | 					let filelines = getline(1, line('$')) | 
					
						
							|  |  |  | 					" 2. Find lines with possible id | 
					
						
							|  |  |  | 					let used_id_lines = filter(filelines, 'v:val =~ "id\\s*=\\s*[\"''][a-zA-Z0-9_-]\\+"') | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 					" 3a. Join all filtered lines | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 					let id_string = join(used_id_lines, ' ') | 
					
						
							|  |  |  | 					" 3b. And split them to be sure each id is in separate item | 
					
						
							|  |  |  | 					let id_list = split(id_string, 'id\s*=\s*') | 
					
						
							|  |  |  | 					" 4. Extract id values | 
					
						
							|  |  |  | 					let used_id = map(id_list, 'matchstr(v:val, "[\"'']\\zs[a-zA-Z0-9_-]\\+\\ze")') | 
					
						
							|  |  |  | 					let joined_used_id = ','.join(used_id, ',').',' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					let allvalues = map(classes, 'matchstr(v:val, ".*#\\zs[a-zA-Z0-9_-]\\+")') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					let values = [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					for element in classes | 
					
						
							|  |  |  | 						if joined_used_id !~ ','.element.',' | 
					
						
							|  |  |  | 							let values += [element] | 
					
						
							|  |  |  | 						endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					endfor | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 				endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				" We need special version of sbase | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 				let classbase = matchstr(context, ".*[\"']") | 
					
						
							| 
									
										
										
										
											2005-09-25 22:16:38 +00:00
										 |  |  | 				let classquote = matchstr(classbase, '.$') | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				let entered_class = matchstr(attr, ".*=\\s*[\"']\\zs.*") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				for m in sort(values) | 
					
						
							|  |  |  | 					if m =~? '^'.entered_class | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 						call add(res, m . classquote) | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 					elseif m =~? entered_class | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 						call add(res2, m . classquote) | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 					endif | 
					
						
							|  |  |  | 				endfor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				return res + res2 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 			elseif context =~? "style\\s*=\\s*[\"'][^\"']*$" | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 				return csscomplete#CompleteCSS(0, context) | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 			" }}} | 
					
						
							|  |  |  | 			" Complete on-events {{{ | 
					
						
							|  |  |  | 			if context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$' | 
					
						
							|  |  |  | 				" We have to: | 
					
						
							|  |  |  | 				" 1. Find external files | 
					
						
							|  |  |  | 				let b:js_extfiles = [] | 
					
						
							|  |  |  | 				let l = line('.') | 
					
						
							|  |  |  | 				let c = col('.') | 
					
						
							|  |  |  | 				call cursor(1,1) | 
					
						
							|  |  |  | 				while search('<\@<=script\>', 'W') && line('.') <= l | 
					
						
							|  |  |  | 					if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment' | 
					
						
							|  |  |  | 						let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1') | 
					
						
							|  |  |  | 						if filereadable(sname) | 
					
						
							|  |  |  | 							let b:js_extfiles += readfile(sname) | 
					
						
							|  |  |  | 						endif | 
					
						
							|  |  |  | 					endif | 
					
						
							|  |  |  | 				endwhile | 
					
						
							|  |  |  | 				" 2. Find at least one <script> tag | 
					
						
							|  |  |  | 				call cursor(1,1) | 
					
						
							|  |  |  | 				let js_scripttags = [] | 
					
						
							|  |  |  | 				while search('<script\>', 'W') && line('.') < l | 
					
						
							|  |  |  | 					if matchstr(getline('.'), '<script[^>]*src') == '' | 
					
						
							|  |  |  | 						let js_scripttag = getline(line('.'), search('</script>', 'W')) | 
					
						
							|  |  |  | 						let js_scripttags += js_scripttag | 
					
						
							|  |  |  | 					endif | 
					
						
							|  |  |  | 				endwhile | 
					
						
							|  |  |  | 				let b:js_extfiles += js_scripttags | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				" 3. Proper call for javascriptcomplete#CompleteJS | 
					
						
							|  |  |  | 				call cursor(l,c) | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 				let js_context = matchstr(a:base, '\k\+$') | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 				let js_shortcontext = substitute(a:base, js_context.'$', '', '') | 
					
						
							|  |  |  | 				let b:compl_context = context | 
					
						
							|  |  |  | 				let b:jsrange = [l, l] | 
					
						
							|  |  |  | 				unlet! l c | 
					
						
							|  |  |  | 				return javascriptcomplete#CompleteJS(0, js_context) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			endif | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 			" }}} | 
					
						
							|  |  |  | 			let stripbase = matchstr(context, ".*\\(on[a-zA-Z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*") | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 			" Now we have context stripped from all chars up to style/class. | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 			" It may fail with some strange style value combinations. | 
					
						
							|  |  |  | 			if stripbase !~ "[\"']" | 
					
						
							|  |  |  | 				return [] | 
					
						
							|  |  |  | 			endif | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 		" Value of attribute completion {{{ | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 		" If attr contains =\s*[\"'] we catched value of attribute | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 		if attr =~ "=\s*[\"']" || attr =~ "=\s*$" | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 			" Let do attribute specific completion | 
					
						
							|  |  |  | 			let attrname = matchstr(attr, '.*\ze\s*=') | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 			let entered_value = matchstr(attr, ".*=\\s*[\"']\\?\\zs.*") | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 			let values = [] | 
					
						
							| 
									
										
										
										
											2007-05-05 17:15:44 +00:00
										 |  |  | 			" Load data {{{ | 
					
						
							|  |  |  | 			if !exists("b:html_doctype") | 
					
						
							|  |  |  | 				call htmlcomplete#CheckDoctype() | 
					
						
							|  |  |  | 			endif | 
					
						
							|  |  |  | 			if !exists("b:html_omni") | 
					
						
							|  |  |  | 				"runtime! autoload/xml/xhtml10s.vim | 
					
						
							|  |  |  | 				call htmlcomplete#LoadData() | 
					
						
							|  |  |  | 			endif | 
					
						
							|  |  |  | 			" }}} | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 			if attrname == 'href' | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 				" Now we are looking for local anchors defined by name or id | 
					
						
							|  |  |  | 				if entered_value =~ '^#' | 
					
						
							|  |  |  | 					let file = join(getline(1, line('$')), ' ') | 
					
						
							|  |  |  | 					" Split it be sure there will be one id/name element in | 
					
						
							|  |  |  | 					" item, it will be also first word [a-zA-Z0-9_-] in element | 
					
						
							|  |  |  | 					let oneelement = split(file, "\\(meta \\)\\@<!\\(name\\|id\\)\\s*=\\s*[\"']") | 
					
						
							|  |  |  | 					for i in oneelement | 
					
						
							|  |  |  | 						let values += ['#'.matchstr(i, "^[a-zA-Z][a-zA-Z0-9%_-]*")] | 
					
						
							|  |  |  | 					endfor | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 			else | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 				if has_key(b:html_omni, tag) && has_key(b:html_omni[tag][1], attrname) | 
					
						
							|  |  |  | 					let values = b:html_omni[tag][1][attrname] | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 				else | 
					
						
							|  |  |  | 					return [] | 
					
						
							|  |  |  | 				endif | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 			endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if len(values) == 0 | 
					
						
							|  |  |  | 				return [] | 
					
						
							|  |  |  | 			endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			" We need special version of sbase | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 			let attrbase = matchstr(context, ".*[\"']") | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 			let attrquote = matchstr(attrbase, '.$') | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 			if attrquote !~ "['\"]" | 
					
						
							|  |  |  | 				let attrquoteopen = '"' | 
					
						
							|  |  |  | 				let attrquote = '"' | 
					
						
							|  |  |  | 			else | 
					
						
							|  |  |  | 				let attrquoteopen = '' | 
					
						
							|  |  |  | 			endif | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			for m in values | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 				" This if is needed to not offer all completions as-is | 
					
						
							|  |  |  | 				" alphabetically but sort them. Those beginning with entered | 
					
						
							|  |  |  | 				" part will be as first choices | 
					
						
							|  |  |  | 				if m =~ '^'.entered_value | 
					
						
							| 
									
										
										
										
											2006-04-24 19:47:27 +00:00
										 |  |  | 					call add(res, attrquoteopen . m . attrquote) | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 				elseif m =~ entered_value | 
					
						
							| 
									
										
										
										
											2006-04-24 19:47:27 +00:00
										 |  |  | 					call add(res2, attrquoteopen . m . attrquote) | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 				endif | 
					
						
							|  |  |  | 			endfor | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			return res + res2 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 		" }}} | 
					
						
							|  |  |  | 		" Attribute completion {{{ | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 		" Shorten context to not include last word | 
					
						
							|  |  |  | 		let sbase = matchstr(context, '.*\ze\s.*') | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		" Load data {{{ | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 		if !exists("b:html_doctype") | 
					
						
							|  |  |  | 			call htmlcomplete#CheckDoctype() | 
					
						
							|  |  |  | 		endif | 
					
						
							|  |  |  | 		if !exists("b:html_omni") | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 			call htmlcomplete#LoadData() | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 		" }}} | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 		if has_key(b:html_omni, tag) | 
					
						
							|  |  |  | 			let attrs = keys(b:html_omni[tag][1]) | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 		else | 
					
						
							|  |  |  | 			return [] | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		for m in sort(attrs) | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 			if m =~ '^'.attr | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 				call add(res, m) | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 			elseif m =~ attr | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 				call add(res2, m) | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 			endif | 
					
						
							|  |  |  | 		endfor | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 		let menu = res + res2 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 		if has_key(b:html_omni, 'vimxmlattrinfo') | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 			let final_menu = [] | 
					
						
							|  |  |  | 			for i in range(len(menu)) | 
					
						
							|  |  |  | 				let item = menu[i] | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 				if has_key(b:html_omni['vimxmlattrinfo'], item) | 
					
						
							|  |  |  | 					let m_menu = b:html_omni['vimxmlattrinfo'][item][0] | 
					
						
							|  |  |  | 					let m_info = b:html_omni['vimxmlattrinfo'][item][1] | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 				else | 
					
						
							|  |  |  | 					let m_menu = '' | 
					
						
							|  |  |  | 					let m_info = '' | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 				endif | 
					
						
							|  |  |  | 				if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$' | 
					
						
							|  |  |  | 					let item = item | 
					
						
							|  |  |  | 					let m_menu = 'Bool' | 
					
						
							|  |  |  | 				else | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 					let item .= '="' | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 				let final_menu += [{'word':item, 'menu':m_menu, 'info':m_info}] | 
					
						
							|  |  |  | 			endfor | 
					
						
							|  |  |  | 		else | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 			let final_menu = [] | 
					
						
							|  |  |  | 			for i in range(len(menu)) | 
					
						
							|  |  |  | 				let item = menu[i] | 
					
						
							|  |  |  | 				if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$' | 
					
						
							|  |  |  | 					let item = item | 
					
						
							|  |  |  | 				else | 
					
						
							|  |  |  | 					let item .= '="' | 
					
						
							|  |  |  | 				endif | 
					
						
							|  |  |  | 				let final_menu += [item] | 
					
						
							|  |  |  | 			endfor | 
					
						
							|  |  |  | 			return final_menu | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 		endif | 
					
						
							|  |  |  | 		return final_menu | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" }}} | 
					
						
							|  |  |  | 	" Close tag {{{ | 
					
						
							| 
									
										
										
										
											2005-09-16 21:47:57 +00:00
										 |  |  | 	let b:unaryTagsStack = "base meta link hr br param img area input col" | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 	if context =~ '^\/' | 
					
						
							| 
									
										
										
										
											2006-03-06 23:29:24 +00:00
										 |  |  | 		if context =~ '^\/.' | 
					
						
							|  |  |  | 			return [] | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack") | 
					
						
							|  |  |  | 			return [opentag.">"] | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2005-09-14 21:32:32 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 	" }}} | 
					
						
							| 
									
										
										
										
											2006-02-18 22:14:51 +00:00
										 |  |  | 	" Load data {{{ | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 	if !exists("b:html_doctype") | 
					
						
							|  |  |  | 		call htmlcomplete#CheckDoctype() | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	if !exists("b:html_omni") | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 		"runtime! autoload/xml/xhtml10s.vim | 
					
						
							|  |  |  | 		call htmlcomplete#LoadData() | 
					
						
							| 
									
										
										
										
											2006-02-18 22:14:51 +00:00
										 |  |  | 	endif | 
					
						
							|  |  |  | 	" }}} | 
					
						
							|  |  |  | 	" Tag completion {{{ | 
					
						
							| 
									
										
										
										
											2005-09-14 21:32:32 +00:00
										 |  |  | 	" Deal with tag completion. | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 	let opentag = tolower(xmlcomplete#GetLastOpenTag("b:unaryTagsStack")) | 
					
						
							| 
									
										
										
										
											2006-03-06 23:29:24 +00:00
										 |  |  | 	" MM: TODO: GLOT works always the same but with some weird situation it | 
					
						
							|  |  |  | 	" behaves as intended in HTML but screws in PHP | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  | 	if opentag == '' || &filetype == 'php' && !has_key(b:html_omni, opentag) | 
					
						
							| 
									
										
										
										
											2006-01-23 22:23:09 +00:00
										 |  |  | 		" Hack for sometimes failing GetLastOpenTag. | 
					
						
							|  |  |  | 		" As far as I tested fail isn't GLOT fault but problem | 
					
						
							|  |  |  | 		" of invalid document - not properly closed tags and other mish-mash. | 
					
						
							| 
									
										
										
										
											2006-02-18 22:14:51 +00:00
										 |  |  | 		" Also when document is empty. Return list of *all* tags. | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	    let tags = keys(b:html_omni) | 
					
						
							| 
									
										
										
										
											2006-02-18 22:14:51 +00:00
										 |  |  | 		call filter(tags, 'v:val !~ "^vimxml"') | 
					
						
							|  |  |  | 	else | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 		if has_key(b:html_omni, opentag) | 
					
						
							|  |  |  | 			let tags = b:html_omni[opentag][0] | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 		else | 
					
						
							|  |  |  | 			return [] | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2005-09-14 21:32:32 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" }}} | 
					
						
							| 
									
										
										
										
											2006-04-30 18:54:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-19 21:23:36 +00:00
										 |  |  | 	if exists("uppercase_tag") && uppercase_tag == 1 | 
					
						
							|  |  |  | 		let context = tolower(context) | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2007-05-05 17:15:44 +00:00
										 |  |  | 	" Handle XML keywords: DOCTYPE | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 	if opentag == '' | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  | 		let tags += [ | 
					
						
							| 
									
										
										
										
											2007-05-05 17:15:44 +00:00
										 |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">', | 
					
						
							|  |  |  | 				\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/1999/xhtml">' | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  | 				\ ] | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2005-09-14 21:32:32 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-06 19:50:41 +00:00
										 |  |  | 	for m in sort(tags) | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 		if m =~ '^'.context | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 			call add(res, m) | 
					
						
							| 
									
										
										
										
											2005-10-10 20:59:28 +00:00
										 |  |  | 		elseif m =~ context | 
					
						
							| 
									
										
										
										
											2005-09-20 23:22:24 +00:00
										 |  |  | 			call add(res2, m) | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2005-09-16 21:47:57 +00:00
										 |  |  | 	endfor | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 	let menu = res + res2 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	if has_key(b:html_omni, 'vimxmltaginfo') | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 		let final_menu = [] | 
					
						
							|  |  |  | 		for i in range(len(menu)) | 
					
						
							|  |  |  | 			let item = menu[i] | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 			if has_key(b:html_omni['vimxmltaginfo'], item) | 
					
						
							|  |  |  | 				let m_menu = b:html_omni['vimxmltaginfo'][item][0] | 
					
						
							|  |  |  | 				let m_info = b:html_omni['vimxmltaginfo'][item][1] | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 			else | 
					
						
							|  |  |  | 				let m_menu = '' | 
					
						
							|  |  |  | 				let m_info = '' | 
					
						
							|  |  |  | 			endif | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  | 			if &filetype == 'html' && exists("uppercase_tag") && uppercase_tag == 1 && item !~ 'DOCTYPE' | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 				let item = toupper(item) | 
					
						
							|  |  |  | 			endif | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  | 			if item =~ 'DOCTYPE' | 
					
						
							|  |  |  | 				let abbr = 'DOCTYPE '.matchstr(item, 'DTD \zsX\?HTML .\{-}\ze\/\/') | 
					
						
							|  |  |  | 			else | 
					
						
							|  |  |  | 				let abbr = item | 
					
						
							|  |  |  | 			endif | 
					
						
							|  |  |  | 			let final_menu += [{'abbr':abbr, 'word':item, 'menu':m_menu, 'info':m_info}] | 
					
						
							| 
									
										
										
										
											2006-02-14 22:29:30 +00:00
										 |  |  | 		endfor | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		let final_menu = menu | 
					
						
							|  |  |  | 	endif | 
					
						
							|  |  |  | 	return final_menu | 
					
						
							| 
									
										
										
										
											2005-09-16 21:47:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | 	" }}} | 
					
						
							| 
									
										
										
										
											2005-09-13 21:20:47 +00:00
										 |  |  |   endif | 
					
						
							|  |  |  | endfunction | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | function! htmlcomplete#LoadData() " {{{ | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	if !exists("b:html_omni_flavor") | 
					
						
							| 
									
										
										
										
											2006-04-23 22:40:29 +00:00
										 |  |  | 		if &filetype == 'html' | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 			let b:html_omni_flavor = 'html401t' | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'xhtml10s' | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	" With that if we still have bloated memory but create new buffer | 
					
						
							|  |  |  | 	" variables only by linking to existing g:variable, not sourcing whole | 
					
						
							|  |  |  | 	" file. | 
					
						
							|  |  |  | 	if exists('g:xmldata_'.b:html_omni_flavor) | 
					
						
							|  |  |  | 		exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim' | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 		exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | endfunction | 
					
						
							|  |  |  | " }}} | 
					
						
							|  |  |  | function! htmlcomplete#CheckDoctype() " {{{ | 
					
						
							|  |  |  | 	if exists('b:html_omni_flavor') | 
					
						
							|  |  |  | 		let old_flavor = b:html_omni_flavor | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		let old_flavor = '' | 
					
						
							|  |  |  | 	endif | 
					
						
							|  |  |  | 	let i = 1 | 
					
						
							|  |  |  | 	while i < 10 && i < line("$") | 
					
						
							|  |  |  | 		let line = getline(i) | 
					
						
							|  |  |  | 		if line =~ '<!DOCTYPE.*\<DTD HTML 3\.2' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'html32' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Transitional' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'html40t' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Frameset' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'html40f' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'html40s' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Transitional' | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 			let b:html_omni_flavor = 'html401t' | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Frameset' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'html401f' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'html401s' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Transitional' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'xhtml10t' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Frameset' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'xhtml10f' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Strict' | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 			let b:html_omni_flavor = 'xhtml10s' | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 		elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.1' | 
					
						
							|  |  |  | 			let b:html_omni_flavor = 'xhtml11' | 
					
						
							|  |  |  | 			let b:html_doctype = 1 | 
					
						
							|  |  |  | 			break | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 		let i += 1 | 
					
						
							|  |  |  | 	endwhile | 
					
						
							|  |  |  | 	if !exists("b:html_doctype") | 
					
						
							|  |  |  | 		return | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 	else | 
					
						
							| 
									
										
										
										
											2006-04-27 00:02:13 +00:00
										 |  |  | 		" Tie g:xmldata with b:html_omni this way we need to sourca data file only | 
					
						
							|  |  |  | 		" once, not every time per buffer. | 
					
						
							|  |  |  | 		if old_flavor == b:html_omni_flavor | 
					
						
							|  |  |  | 			return | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			if exists('g:xmldata_'.b:html_omni_flavor) | 
					
						
							|  |  |  | 				exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor | 
					
						
							|  |  |  | 			else | 
					
						
							|  |  |  | 				exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim' | 
					
						
							|  |  |  | 				exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor | 
					
						
							|  |  |  | 			endif | 
					
						
							|  |  |  | 			return | 
					
						
							|  |  |  | 		endif | 
					
						
							| 
									
										
										
										
											2006-04-18 21:55:01 +00:00
										 |  |  | 	endif | 
					
						
							|  |  |  | endfunction | 
					
						
							|  |  |  | " }}} | 
					
						
							| 
									
										
										
										
											2006-02-08 09:20:24 +00:00
										 |  |  | " vim:set foldmethod=marker: |