diff options
author | Christian Clason <c.clason@uni-graz.at> | 2024-07-28 22:29:20 +0200 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-07-29 09:12:14 +0200 |
commit | e596b6a18d84aa56b5189bb7921feec58279976c (patch) | |
tree | c5708010ea65689dd2319ecf9c318d21890a2139 | |
parent | 8168b228e0f6b917344f2735608314ef81606358 (diff) | |
download | rneovim-e596b6a18d84aa56b5189bb7921feec58279976c.tar.gz rneovim-e596b6a18d84aa56b5189bb7921feec58279976c.tar.bz2 rneovim-e596b6a18d84aa56b5189bb7921feec58279976c.zip |
vim-patch:9.1.0635: filetype: SuperHTML template files not recognized
Problem: filetype: SuperHTML template files not recognized
Solution: Update the filetype detection code to detect '*.shtml' either
as HTML (Server Side Includes) or SuperHTML (template files)
(EliSauder)
related: vim/vim#15355
related: vim/vim#15367
https://github.com/vim/vim/commit/e57c9a19edc906a96ccb8821ae33fa6a8b20c3cd
Co-authored-by: EliSauder <24995216+EliSauder@users.noreply.github.com>
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 2 | ||||
-rw-r--r-- | test/old/testdir/test_filetype.vim | 32 |
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') |