mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 05:20:04 +08:00
Fix lint
This commit is contained in:
parent
19e1e1d9f7
commit
2e7c81f5d1
@ -17,7 +17,7 @@ function! s:nr2byte(nr) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:nr2enc_char(charcode) abort
|
function! s:nr2enc_char(charcode) abort
|
||||||
if &encoding == 'utf-8'
|
if &encoding ==# 'utf-8'
|
||||||
return nr2char(a:charcode)
|
return nr2char(a:charcode)
|
||||||
endif
|
endif
|
||||||
let char = s:nr2byte(a:charcode)
|
let char = s:nr2byte(a:charcode)
|
||||||
@ -29,7 +29,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:nr2hex(nr) abort
|
function! s:nr2hex(nr) abort
|
||||||
let n = a:nr
|
let n = a:nr
|
||||||
let r = ""
|
let r = ''
|
||||||
while n
|
while n
|
||||||
let r = '0123456789ABCDEF'[n % 16] . r
|
let r = '0123456789ABCDEF'[n % 16] . r
|
||||||
let n = n / 16
|
let n = n / 16
|
||||||
@ -188,12 +188,12 @@ function! s:self.createElement(name) abort
|
|||||||
return node
|
return node
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" @vimlint(EVL102, 1, l:content)
|
||||||
function! s:parse_tree(ctx, top) abort
|
function! s:parse_tree(ctx, top) abort
|
||||||
let node = a:top
|
let node = a:top
|
||||||
let stack = [a:top]
|
let stack = [a:top]
|
||||||
" content accumulates the text only tags
|
" content accumulates the text only tags
|
||||||
" @vimlint(EVL102, 1, l:content)
|
let content = ''
|
||||||
let content = ""
|
|
||||||
let append_content_to_parent = 'if len(stack) && content != "" | call add(stack[-1].child, content) | let content ="" | endif'
|
let append_content_to_parent = 'if len(stack) && content != "" | call add(stack[-1].child, content) | let content ="" | endif'
|
||||||
|
|
||||||
let mx = '^\s*\(<?xml[^>]\+>\)'
|
let mx = '^\s*\(<?xml[^>]\+>\)'
|
||||||
@ -228,8 +228,8 @@ function! s:parse_tree(ctx, top) abort
|
|||||||
let m = matchlist(a:ctx.xml, tag_mx)
|
let m = matchlist(a:ctx.xml, tag_mx)
|
||||||
if empty(m) | break | endif
|
if empty(m) | break | endif
|
||||||
let a:ctx.xml = a:ctx.xml[len(m[0]) :]
|
let a:ctx.xml = a:ctx.xml[len(m[0]) :]
|
||||||
let is_end_tag = m[2] == '/' && m[5] == ''
|
let is_end_tag = m[2] ==# '/' && m[5] ==# ''
|
||||||
let is_start_and_end_tag = m[2] == '' && m[5] == '/'
|
let is_start_and_end_tag = m[2] ==# '' && m[5] ==# '/'
|
||||||
let tag_name = m[3]
|
let tag_name = m[3]
|
||||||
let attrs = m[4]
|
let attrs = m[4]
|
||||||
|
|
||||||
@ -248,12 +248,12 @@ function! s:parse_tree(ctx, top) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" comment tag
|
" comment tag
|
||||||
if m[8] != ''
|
if m[8] !=# ''
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" if element is a CDATA
|
" if element is a CDATA
|
||||||
if m[6] != ''
|
if m[6] !=# ''
|
||||||
let content .= m[7]
|
let content .= m[7]
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@ -267,8 +267,8 @@ function! s:parse_tree(ctx, top) abort
|
|||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let name = attr_match[1]
|
let name = attr_match[1]
|
||||||
let value = len(attr_match[2]) ? attr_match[2] : len(attr_match[3]) ? attr_match[3] : len(attr_match[4]) ? attr_match[4] : ""
|
let value = len(attr_match[2]) ? attr_match[2] : len(attr_match[3]) ? attr_match[3] : len(attr_match[4]) ? attr_match[4] : ''
|
||||||
if value == ""
|
if value ==# ''
|
||||||
let value = name
|
let value = name
|
||||||
endif
|
endif
|
||||||
let node.attr[name] = s:decodeEntityReference(value)
|
let node.attr[name] = s:decodeEntityReference(value)
|
||||||
@ -285,8 +285,8 @@ function! s:parse_tree(ctx, top) abort
|
|||||||
call add(stack, node)
|
call add(stack, node)
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
" @vimlint(EVL102, 0, l:content)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
" @vimlint(EVL102, 0, l:content)
|
||||||
|
|
||||||
|
|
||||||
function! s:self.parse(xml) abort
|
function! s:self.parse(xml) abort
|
||||||
@ -307,7 +307,7 @@ function! s:self.parse(xml) abort
|
|||||||
"endtry
|
"endtry
|
||||||
let &maxmempattern=oldmaxmempattern
|
let &maxmempattern=oldmaxmempattern
|
||||||
let &maxfuncdepth=oldmaxfuncdepth
|
let &maxfuncdepth=oldmaxfuncdepth
|
||||||
throw "Parse Error"
|
throw 'Parse Error'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:self.parseFile(file) abort
|
function! s:self.parseFile(file) abort
|
||||||
@ -318,7 +318,7 @@ function! s:self.parseURL(url) abort
|
|||||||
return self.parse(s:HTTP.get(a:url).content)
|
return self.parse(s:HTTP.get(a:url).content)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#api#web#xml#get()
|
function! SpaceVim#api#web#xml#get() abort
|
||||||
return deepcopy(s:self)
|
return deepcopy(s:self)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user