diff options
| -rw-r--r-- | autoload/polyglot.vim | 2 | ||||
| -rw-r--r-- | heuristics.yaml | 2 | ||||
| -rw-r--r-- | tests/extensions.vim | 4 | 
3 files changed, 5 insertions, 3 deletions
diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim index 07d9fe31..33210855 100644 --- a/autoload/polyglot.vim +++ b/autoload/polyglot.vim @@ -378,7 +378,7 @@ 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\)\(\<\|\>\)\|{#\s\+' +    if line =~# '{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)\|{#\s\+'        set ft=htmldjango | return      endif      if line =~# '\(\<\|\>\)DTD\s\+XHTML\s' diff --git a/heuristics.yaml b/heuristics.yaml index c53a704c..129734f8 100644 --- a/heuristics.yaml +++ b/heuristics.yaml @@ -182,7 +182,7 @@ rules:    filetype: mason  - lines: 50    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)\b|{#\s+'      filetype: htmldjango    - pattern: '\bDTD\s+XHTML\s'      filetype: xhtml diff --git a/tests/extensions.vim b/tests/extensions.vim index 7f6adb9e..45ee6c7d 100644 --- a/tests/extensions.vim +++ b/tests/extensions.vim @@ -364,12 +364,14 @@ call TestExtension("tt2html", "html.tt2", "<html>")  call TestExtension("html", "empty.html", "")  call TestExtension("mason", "mason1.html", "% my $planet = 42;")  call TestExtension("mason", "mason2.html", "<%filter></%filter>") -call TestExtension("htmldjango", "jinja1.html", "{{ item.href }}")  call TestExtension("htmldjango", "jinja2.html", "{% for item in navigation %}{% endfor %}")  call TestExtension("htmldjango", "jinja3.html", "{% block head %}")  call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")  call TestExtension("xhtml", "xhtml.html", "<DTD   XHTML ") +" many html templates use {{ }}, e.g. Angular, we should not assume django +call TestExtension("html", "template.html", "{{ item.href }}") +  " .gitignore  call TestExtension("gitignore", ".gitignore", "")  | 
