patch 9.1.0635: filetype: SuperHTML template files not recognized

Commit: 
https://github.com/vim/vim/commit/e57c9a19edc906a96ccb8821ae33fa6a8b20c3cd
Author: EliSauder <24995216+elisau...@users.noreply.github.com>
Date:   Sun Jul 28 21:28:11 2024 +0200

    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: #15355
    related: #15367
    
    Signed-off-by: EliSauder <24995216+elisau...@users.noreply.github.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index e53cdacbe..c8942eb3d 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -421,7 +421,6 @@ export def FThtml()
       setf htmlangular
       return
     endif
-
     # Check for XHTML
     if getline(n) =~ '\<DTD\s\+XHTML\s'
       setf xhtml
@@ -432,6 +431,11 @@ export def FThtml()
       setf htmldjango
       return
     endif
+    # Check for SuperHTML
+    if getline(n) =~ '<extend\|<super>'
+        setf superhtml
+        return
+    endif
     n += 1
   endwhile
   setf FALLBACK html
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index d02826578..bdf591ac7 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1039,7 +1039,7 @@ au BufNewFile,BufRead *.t.html                    setf 
tilde
 " Translate shell
 au BufNewFile,BufRead init.trans,*/etc/translate-shell,.trans  setf clojure
 
-" HTML (.shtml and .stm for server side)
+" HTML (.stm for server side, .shtml is server-side or superhtml)
 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm  call dist#ft#FThtml()
 au BufNewFile,BufRead *.cshtml                 setf html
 
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index f8b3ea872..3aa3e97f4 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -1603,6 +1603,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')
diff --git a/src/version.c b/src/version.c
index 652042295..a321cc53e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    635,
 /**/
     634,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sY9pH-00HJTG-04%40256bit.org.

Raspunde prin e-mail lui