Fixes errors on lint. #236

This commit is contained in:
mattn
2014-11-06 20:02:36 +09:00
parent 4b17969f5a
commit 8b703a0a00
6 changed files with 26 additions and 32 deletions

View File

@@ -123,29 +123,30 @@ function! emmet#isExpandable()
endfunction
function! emmet#mergeConfig(lhs, rhs)
if type(a:lhs) == 3 && type(a:rhs) == 3
let a:lhs += a:rhs
if len(a:lhs)
call remove(a:lhs, 0, len(a:lhs)-1)
let [lhs, rhs] = [a:lhs, a:rhs]
if type(lhs) == 3 && type(rhs) == 3
let lhs += rhs
if len(lhs)
call remove(lhs, 0, len(lhs)-1)
endif
for rhi in a:rhs
call add(a:lhs, a:rhs[rhi])
for rhi in rhs
call add(lhs, rhs[rhi])
endfor
elseif type(a:lhs) == 4 && type(a:rhs) == 4
for key in keys(a:rhs)
if type(a:rhs[key]) == 3
if !has_key(a:lhs, key)
let a:lhs[key] = []
elseif type(lhs) == 4 && type(rhs) == 4
for key in keys(rhs)
if type(rhs[key]) == 3
if !has_key(lhs, key)
let lhs[key] = []
endif
let a:lhs[key] += a:rhs[key]
elseif type(a:rhs[key]) == 4
if has_key(a:lhs, key)
call emmet#mergeConfig(a:lhs[key], a:rhs[key])
let lhs[key] += rhs[key]
elseif type(rhs[key]) == 4
if has_key(lhs, key)
call emmet#mergeConfig(lhs[key], rhs[key])
else
let a:lhs[key] = a:rhs[key]
let lhs[key] = rhs[key]
endif
else
let a:lhs[key] = a:rhs[key]
let lhs[key] = rhs[key]
endif
endfor
endif
@@ -297,7 +298,6 @@ function! emmet#getResource(type, name, default)
endif
for ext in extends
if has_key(s:emmet_settings, ext) && has_key(s:emmet_settings[ext], a:name)
let V = s:emmet_settings[ext][a:name]
if type(ret) == 3 || type(ret) == 4
call emmet#mergeConfig(ret, s:emmet_settings[ext][a:name])
else
@@ -308,7 +308,6 @@ function! emmet#getResource(type, name, default)
endif
if has_key(s:emmet_settings[a:type], a:name)
let v = s:emmet_settings[a:type][a:name]
if type(ret) == 3 || type(ret) == 4
call emmet#mergeConfig(ret, s:emmet_settings[a:type][a:name])
else
@@ -430,7 +429,6 @@ endfunction
function! emmet#expandCursorExpr(expand, mode)
let expand = a:expand
let type = emmet#getFileType()
if expand !~ '\${cursor}'
if a:mode == 2
let expand = '${cursor}' . expand
@@ -479,6 +477,8 @@ function! emmet#expandAbbr(mode, abbr) range
let spl = emmet#splitFilterArg(filters)
let fline = getline(a:firstline)
let query = substitute(query, '>\{0,1}{\$#}\s*$', '{\\$column\\$}*' . len(split(fline, spl)), '')
else
let spl = ''
endif
let items = emmet#parseIntoTree(query, type).child
for item in items

View File

@@ -8,7 +8,6 @@ function! emmet#lang#css#parseIntoTree(abbr, type)
let prefix = 0
let value = ''
let settings = emmet#getSettings()
let indent = emmet#getIndentation(type)
let aliases = emmet#getResource(type, 'aliases', {})
let snippets = emmet#getResource(type, 'snippets', {})

View File

@@ -18,8 +18,6 @@ function! emmet#lang#haml#toString(settings, current, type, inline, filters, ite
let attribute_style = emmet#getResource('haml', 'attribute_style', 'hash')
let str = ""
let comment_indent = ''
let comment = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current.name, '\$$', itemno+1, '')
@@ -165,8 +163,8 @@ function! emmet#lang#haml#parseTag(tag)
let current = emmet#newNode()
let mx = '%\([a-zA-Z][a-zA-Z0-9]*\)\s*\%({\(.*\)}\)'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', 'i')
let attrs = substitute(match, mx, '\2', 'i')
let current.name = substitute(match, mx, '\1', '')
let attrs = substitute(match, mx, '\2', '')
let mx = '\([a-zA-Z0-9]\+\)\s*=>\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)

View File

@@ -402,7 +402,8 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
return text
endif
if len(current_name) > 0
let str .= '<' . current_name
let str .= '<' . current_name
endif
for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
if !has_key(current.attr, attr)
continue

View File

@@ -7,7 +7,6 @@ function! emmet#lang#slim#parseIntoTree(abbr, type)
endfunction
function! emmet#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
@@ -17,8 +16,6 @@ function! emmet#lang#slim#toString(settings, current, type, inline, filters, ite
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
let str = ""
let comment_indent = ''
let comment = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current.name, '\$$', itemno+1, '')
@@ -124,8 +121,8 @@ function! emmet#lang#slim#parseTag(tag)
let current = emmet#newNode()
let mx = '\([a-zA-Z][a-zA-Z0-9]*\)\s\+\(.*\)'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', 'i')
let attrs = substitute(match, mx, '\2', 'i')
let current.name = substitute(match, mx, '\1', '')
let attrs = substitute(match, mx, '\2', '')
let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)

View File

@@ -283,7 +283,6 @@ function! emmet#util#getImageSize(fn)
endfunction
function! emmet#util#imageSizeWithImageMagick(fn)
let fn = a:fn
let img_info = system('identify -format "%wx%h" "'.a:fn.'"')
let img_size = split(substitute(img_info, '\n', '', ''), 'x')
if len(img_size) != 2