diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-14 23:26:36 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-14 23:26:36 +0200 |
commit | ba11e0f1ad214a0696ab48fbfdf06afd08ad2f91 (patch) | |
tree | 5d023d134d9222f939b3f8b015f133cad31a8c41 | |
parent | c45f0b8f640156142773eeb4d13b86b79605291a (diff) | |
download | vim-polyglot-ba11e0f1ad214a0696ab48fbfdf06afd08ad2f91.tar.gz vim-polyglot-ba11e0f1ad214a0696ab48fbfdf06afd08ad2f91.zip |
Improve django detection, closes #585
-rw-r--r-- | autoload/polyglot/detect.vim | 2 | ||||
-rw-r--r-- | heuristics.yaml | 2 | ||||
-rw-r--r-- | tests/extensions.vim | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/autoload/polyglot/detect.vim b/autoload/polyglot/detect.vim index bdd2e48d..b1b5d6d7 100644 --- a/autoload/polyglot/detect.vim +++ b/autoload/polyglot/detect.vim @@ -298,7 +298,7 @@ func! polyglot#detect#Html(...) 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\|load\)\(\<\|\>\)\|{#\s\+' set ft=htmldjango | return endif if line =~# '\(\<\|\>\)DTD\s\+XHTML\s' diff --git a/heuristics.yaml b/heuristics.yaml index 4080cbc4..23f63bb4 100644 --- a/heuristics.yaml +++ b/heuristics.yaml @@ -188,7 +188,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|load)\b|{#\s+' filetype: htmldjango - pattern: '\bDTD\s+XHTML\s' filetype: xhtml diff --git a/tests/extensions.vim b/tests/extensions.vim index de074e5d..6b4b7fe8 100644 --- a/tests/extensions.vim +++ b/tests/extensions.vim @@ -371,6 +371,7 @@ call TestExtension("mason", "mason2.html", "<%filter></%filter>") 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("htmldjango", "jinja3.html", "{% load static %}") call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ") " many html templates use {{ }}, e.g. Angular, we should not assume django |