mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-10 12:33:51 -05:00
Improve django detection, closes #585
This commit is contained in:
@@ -298,7 +298,7 @@ func! polyglot#detect#Html(...)
|
|||||||
endif
|
endif
|
||||||
for lnum in range(1, min([line("$"), 50]))
|
for lnum in range(1, min([line("$"), 50]))
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
if line =~# '{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)\|{#\s\+'
|
if line =~# '{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\|load\)\(\<\|\>\)\|{#\s\+'
|
||||||
set ft=htmldjango | return
|
set ft=htmldjango | return
|
||||||
endif
|
endif
|
||||||
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
|
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ rules:
|
|||||||
filetype: mason
|
filetype: mason
|
||||||
- lines: 50
|
- lines: 50
|
||||||
rules:
|
rules:
|
||||||
- pattern: '{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans)\b|{#\s+'
|
- pattern: '{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans|load)\b|{#\s+'
|
||||||
filetype: htmldjango
|
filetype: htmldjango
|
||||||
- pattern: '\bDTD\s+XHTML\s'
|
- pattern: '\bDTD\s+XHTML\s'
|
||||||
filetype: xhtml
|
filetype: xhtml
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ call TestExtension("mason", "mason2.html", "<%filter></%filter>")
|
|||||||
call TestExtension("htmldjango", "jinja2.html", "{% for item in navigation %}{% endfor %}")
|
call TestExtension("htmldjango", "jinja2.html", "{% for item in navigation %}{% endfor %}")
|
||||||
call TestExtension("htmldjango", "jinja3.html", "{% block head %}")
|
call TestExtension("htmldjango", "jinja3.html", "{% block head %}")
|
||||||
call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")
|
call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")
|
||||||
|
call TestExtension("htmldjango", "jinja3.html", "{% load static %}")
|
||||||
call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ")
|
call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ")
|
||||||
|
|
||||||
" many html templates use {{ }}, e.g. Angular, we should not assume django
|
" many html templates use {{ }}, e.g. Angular, we should not assume django
|
||||||
|
|||||||
Reference in New Issue
Block a user