mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
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
e57c9a19ed
Co-authored-by: EliSauder <24995216+EliSauder@users.noreply.github.com>
This commit is contained in:
@@ -735,6 +735,8 @@ function M.html(_, bufnr)
|
|||||||
)
|
)
|
||||||
then
|
then
|
||||||
return 'htmldjango'
|
return 'htmldjango'
|
||||||
|
elseif findany(line, { '<extend', '<super>' }) then
|
||||||
|
return 'superhtml'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return 'html'
|
return 'html'
|
||||||
|
@@ -1598,6 +1598,38 @@ func Test_html_file()
|
|||||||
call assert_equal('htmldjango', &filetype)
|
call assert_equal('htmldjango', &filetype)
|
||||||
bwipe!
|
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
|
" regular HTML
|
||||||
let content = ['<!DOCTYPE html>', '<html>', ' <head>Foobar</head>', ' <body>Content', ' </body>', '</html>']
|
let content = ['<!DOCTYPE html>', '<html>', ' <head>Foobar</head>', ' <body>Content', ' </body>', '</html>']
|
||||||
call writefile(content, 'Xfile.html', 'D')
|
call writefile(content, 'Xfile.html', 'D')
|
||||||
|
Reference in New Issue
Block a user