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

View File

@@ -8,7 +8,6 @@ function! emmet#lang#css#parseIntoTree(abbr, type)
let prefix = 0 let prefix = 0
let value = '' let value = ''
let settings = emmet#getSettings()
let indent = emmet#getIndentation(type) let indent = emmet#getIndentation(type)
let aliases = emmet#getResource(type, 'aliases', {}) let aliases = emmet#getResource(type, 'aliases', {})
let snippets = emmet#getResource(type, 'snippets', {}) 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 attribute_style = emmet#getResource('haml', 'attribute_style', 'hash')
let str = "" let str = ""
let comment_indent = ''
let comment = ''
let current_name = current.name let current_name = current.name
if dollar_expr if dollar_expr
let current_name = substitute(current.name, '\$$', itemno+1, '') let current_name = substitute(current.name, '\$$', itemno+1, '')
@@ -165,8 +163,8 @@ function! emmet#lang#haml#parseTag(tag)
let current = emmet#newNode() let current = emmet#newNode()
let mx = '%\([a-zA-Z][a-zA-Z0-9]*\)\s*\%({\(.*\)}\)' let mx = '%\([a-zA-Z][a-zA-Z0-9]*\)\s*\%({\(.*\)}\)'
let match = matchstr(a:tag, mx) let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', 'i') let current.name = substitute(match, mx, '\1', '')
let attrs = substitute(match, mx, '\2', 'i') let attrs = substitute(match, mx, '\2', '')
let mx = '\([a-zA-Z0-9]\+\)\s*=>\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)' let mx = '\([a-zA-Z0-9]\+\)\s*=>\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0 while len(attrs) > 0
let match = matchstr(attrs, mx) let match = matchstr(attrs, mx)

View File

@@ -403,6 +403,7 @@ function! emmet#lang#html#toString(settings, current, type, inline, filters, ite
endif endif
if len(current_name) > 0 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)) for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
if !has_key(current.attr, attr) if !has_key(current.attr, attr)
continue continue

View File

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

View File

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