File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -258,6 +258,14 @@ let s:html_indent_tags = '[a-z_][a-z0-9_.-]*'
258258let s: cpo_save = &cpo
259259set cpo -= C
260260
261+ " [-- count self close tags of line a:lnum --]
262+ fun ! <SID> HtmlIndentAloneClose (lnum)
263+ let s = substitute (' x' .getline (a: lnum ),
264+ \ ' .\{-}\(/>\)' , " \1 " , ' g' )
265+ let s = substitute (s , " [^\1 ].*$" , ' ' , ' ' )
266+ return strlen (s )
267+ endfun
268+
261269" [-- count indent-increasing tags of line a:lnum --]
262270fun ! <SID> HtmlIndentOpen (lnum, pattern)
263271 let s = substitute (' x' .getline (a: lnum ),
@@ -290,6 +298,7 @@ fun! <SID>HtmlIndentSum(lnum, style)
290298 if a: style == match (getline (a: lnum ), ' ^\s*</\<\(' .s: html_indent_tags .' \)\>' )
291299 let open = <SID> HtmlIndentOpen (a: lnum , s: html_indent_tags ) - <SID> HtmlIndentOpen (a: lnum , s: html_noindent_tags )
292300 let close = <SID> HtmlIndentClose (a: lnum , s: html_indent_tags ) - <SID> HtmlIndentClose (a: lnum , s: html_noindent_tags )
301+ \ + <SID> HtmlIndentAloneClose (a: lnum )
293302 if 0 != open || 0 != close
294303 return open - close
295304 endif
You can’t perform that action at this time.
0 commit comments