Edgewall Software

source: contrib/vim/ftdetect/genshi.vim

Last change on this file was 489, checked in by mgood, 17 years ago

Vim: make Genshi detection more explicit to avoid false positives

File size: 466 bytes
Line 
1au BufNewFile,BufRead * call s:FTgenshi()
2
3fun! s:FTgenshi()
4  let n = 1
5  if expand('%:e') =~ 'htm[l]\?'
6    let b:genshi_type = 'html'
7  else
8    let b:genshi_type = 'xml'
9  endif
10  while n < 10 && n < line("$")
11    if getline(n) =~ '\<DTD\s\+XHTML\s'
12      let b:genshi_type = 'html'
13    endif
14    if getline(n) =~ 'xmlns:py="http://genshi.edgewall.org/"'
15      set filetype=genshi
16      return
17    endif
18    let n = n + 1
19  endwhile
20  unlet b:genshi_type
21endfun
Note: See TracBrowser for help on using the repository browser.