runtime(filetype): update htmldjango detection
Commit:
https://github.com/vim/vim/commit/9718ed7ab989c0a0be88a0d749f24321eb0e6af1
Author: Afiq Nazrie <[email protected]>
Date: Tue Jun 18 19:59:53 2024 +0200
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: #15037
Signed-off-by: Afiq Nazrie <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index bf9e32e78..50b4c3ef2 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -405,12 +405,12 @@ enddef
# Distinguish between HTML, XHTML and Django
export def FThtml()
var n = 1
- while n < 10 && n <= line("$")
+ while n < 40 && n <= line("$")
if getline(n) =~ '\<DTD\s\+XHTML\s'
setf xhtml
return
endif
- if getline(n) =~ '{%\s*\(extends\|block\|load\)\>\|{#\s\+'
+ if getline(n) =~
'{%\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\+'
setf htmldjango
return
endif
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1sJdMK-003IEr-Vb%40256bit.org.