mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9718ed7: runtime(filetype): update htmldjango detection
- update tags to detect djangohtml based on
https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#built-in-tag-reference
- increase the lines to inspect to 40 lines
10 lines is too few and might result in high false negative.
Increasing it to 40 lines should reduce the false negative.
closes: vim/vim#15037
9718ed7ab9
Co-authored-by: Afiq Nazrie <afnazrie@gmail.com>
This commit is contained in:
parent
102971a396
commit
6012f79557
@ -676,10 +676,15 @@ end
|
||||
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.html(_, bufnr)
|
||||
for _, line in ipairs(getlines(bufnr, 1, 10)) do
|
||||
for _, line in ipairs(getlines(bufnr, 1, 40)) do
|
||||
if matchregex(line, [[\<DTD\s\+XHTML\s]]) then
|
||||
return 'xhtml'
|
||||
elseif matchregex(line, [[\c{%\s*\(extends\|block\|load\)\>\|{#\s\+]]) then
|
||||
elseif
|
||||
matchregex(
|
||||
line,
|
||||
[[\c{%\s*\(autoescape\|block\|comment\|csrf_token\|cycle\|debug\|extends\|filter\|firstof\|for\|if\|ifchanged\|include\|load\|lorem\|now\|query_string\|regroup\|resetcycle\|spaceless\|templatetag\|url\|verbatim\|widthratio\|with\)\>\|{#\s\+]]
|
||||
)
|
||||
then
|
||||
return 'htmldjango'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user