aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/lua/vim/filetype/detect.lua2
-rw-r--r--test/old/testdir/test_filetype.vim32
2 files changed, 34 insertions, 0 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index cb953f9d0c..1cc81b177f 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -735,6 +735,8 @@ function M.html(_, bufnr)
)
then
return 'htmldjango'
+ elseif findany(line, { '<extend', '<super>' }) then
+ return 'superhtml'
end
end
return 'html'
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index 83aff0205b..4daa321ec7 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -1598,6 +1598,38 @@ func Test_html_file()
call assert_equal('htmldjango', &filetype)
bwipe!
+ " Super html layout
+ let content = ['<extend template="base.shtml">',
+ \ '<title id="title" var="$page.title"></title>',
+ \ '<head id="head"></head>',
+ \ '<div id="content">',
+ \ '</div>']
+ call writefile(content, 'Xfile.shtml', 'D')
+ split Xfile.shtml
+ call assert_equal('superhtml', &filetype)
+ bwipe!
+
+ " Super html template
+ let content = ['<!DOCTYPE html>',
+ \ '<html>',
+ \ ' <head id="head">',
+ \ ' <title id="title">',
+ \ ' <super>',
+ \ ' suffix',
+ \ ' </title>',
+ \ ' <super>',
+ \ ' </head>',
+ \ ' <body>',
+ \ ' <div id="content">',
+ \ ' <super>',
+ \ ' </div>',
+ \ ' </body>',
+ \ '</html>']
+ call writefile(content, 'Xfile.shtml', 'D')
+ split Xfile.shtml
+ call assert_equal('superhtml', &filetype)
+ bwipe!
+
" regular HTML
let content = ['<!DOCTYPE html>', '<html>', ' <head>Foobar</head>', ' <body>Content', ' </body>', '</html>']
call writefile(content, 'Xfile.html', 'D')