aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorJustin Gassner <justin.gassner@web.de>2016-01-25 19:36:57 +0100
committerJustin Gassner <justin.gassner@web.de>2016-01-25 21:45:26 +0100
commit299044d4efff0f3ea0ae910977ebe77099cfebf4 (patch)
treeb31b8baec4752be50cf6fc270092b85c768a7202 /runtime/indent
parent45b378259ebc66530cfa2a3fdb2504f17a185a22 (diff)
downloadrneovim-299044d4efff0f3ea0ae910977ebe77099cfebf4.tar.gz
rneovim-299044d4efff0f3ea0ae910977ebe77099cfebf4.tar.bz2
rneovim-299044d4efff0f3ea0ae910977ebe77099cfebf4.zip
vim-patch:7.4.656
Problem: Missing changes for glob() in one file. Solution: Add the missing changes. https://github.com/vim/vim/commit/d8b77f7dc04e5721989df9c505b8568194261a39
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/html.vim41
1 files changed, 39 insertions, 2 deletions
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index b97a905988..71443abe5b 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -245,6 +245,10 @@ call s:AddITags(s:indent_tags, [
\ 'header', 'group', 'keygen', 'mark', 'math', 'meter', 'nav', 'output',
\ 'progress', 'ruby', 'section', 'svg', 'texture', 'time', 'video',
\ 'wbr', 'text'])
+
+" Tags added for web components:
+call s:AddITags(s:indent_tags, [
+ \ 'content', 'shadow', 'template'])
"}}}
" Add Block Tags: these contain alien content
@@ -287,7 +291,7 @@ func! s:CountITags(text)
let s:nextrel = 0 " relative indent steps for next line [unit &sw]:
let s:block = 0 " assume starting outside of a block
let s:countonly = 1 " don't change state
- call substitute(a:text, '<\zs/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
+ call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
let s:countonly = 0
endfunc "}}}
@@ -299,7 +303,7 @@ func! s:CountTagsAndState(text)
let s:nextrel = 0 " relative indent steps for next line [unit &sw]:
let s:block = b:hi_newstate.block
- let tmp = substitute(a:text, '<\zs/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
+ let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
if s:block == 3
let b:hi_newstate.scripttype = s:GetScriptType(matchstr(tmp, '\C.*<SCRIPT\>\zs[^>]*'))
endif
@@ -311,6 +315,9 @@ func! s:CheckTag(itag)
"{{{
" Returns an empty string or "SCRIPT".
" a:itag can be "tag" or "/tag" or "<!--" or "-->"
+ if (s:CheckCustomTag(a:itag))
+ return ""
+ endif
let ind = s:get_tag(a:itag)
if ind == -1
" closing tag
@@ -365,6 +372,36 @@ func! s:CheckBlockTag(blocktag, ind)
return ""
endfunc "}}}
+" Used by s:CheckTag().
+func! s:CheckCustomTag(ctag)
+ "{{{
+ " Returns 1 if ctag is the tag for a custom element, 0 otherwise.
+ " a:ctag can be "tag" or "/tag" or "<!--" or "-->"
+ let pattern = '\%\(\w\+-\)\+\w\+'
+ if match(a:ctag, pattern) == -1
+ return 0
+ endif
+ if matchstr(a:ctag, '\/\ze.\+') == "/"
+ " closing tag
+ if s:block != 0
+ " ignore ctag within a block
+ return 1
+ endif
+ if s:nextrel == 0
+ let s:curind -= 1
+ else
+ let s:nextrel -= 1
+ endif
+ else
+ " opening tag
+ if s:block != 0
+ return 1
+ endif
+ let s:nextrel += 1
+ endif
+ return 1
+endfunc "}}}
+
" Return the <script> type: either "javascript" or ""
func! s:GetScriptType(str)
"{{{