Improve html heuristics

This commit is contained in:
Adam Stankiewicz
2020-09-24 09:24:13 +02:00
parent c284af58fa
commit 6b4da27538
4 changed files with 21 additions and 9 deletions

View File

@@ -372,9 +372,12 @@ func! polyglot#DetectHtmlFiletype()
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '{{.*}}\|{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)'
if line =~# '{{.*}}\|{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)\|{#\s\+'
set ft=jinja.html | return
endif
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
set ft=xhtml | return
endif
endfor
set ft=html | return
endfunc