Merge pull request #217 from conraddecker/master

Changed 'parenthesis' setting to 'attribute_style' setting
This commit is contained in:
mattn
2014-07-18 17:27:31 +09:00
2 changed files with 24 additions and 6 deletions

View File

@@ -1671,7 +1671,7 @@ let s:emmet_settings = {
\ ."\t%body\n"
\ ."\t\t${child}|\n",
\ },
\ 'parentheses': '{}',
\ 'attribute_style': 'hash',
\ },
\ 'slim': {
\ 'indentation': ' ',

View File

@@ -15,7 +15,7 @@ function! emmet#lang#haml#toString(settings, current, type, inline, filters, ite
let itemno = a:itemno
let indent = emmet#getIndentation(type)
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
let parentheses = emmet#getResource('haml', 'parentheses', '()')
let attribute_style = emmet#getResource('haml', 'attribute_style', 'hash')
let str = ""
let comment_indent = ''
@@ -33,7 +33,11 @@ function! emmet#lang#haml#toString(settings, current, type, inline, filters, ite
endif
let Val = current.attr[attr]
if type(Val) == 2 && Val == function('emmet#types#true')
let tmp .= ' :' . attr . ' => true'
if attribute_style == 'hash'
let tmp .= ' :' . attr . ' => true'
elseif attribute_style == 'html'
let tmp .= attr . '=true'
end
else
if dollar_expr
while Val =~ '\$\([^#{]\|$\)'
@@ -47,14 +51,28 @@ function! emmet#lang#haml#toString(settings, current, type, inline, filters, ite
elseif attr == 'class' && len(valtmp) > 0
let str .= '.' . substitute(Val, ' ', '.', 'g')
else
if len(tmp) > 0 | let tmp .= ',' | endif
if len(tmp) > 0
if attribute_style == 'hash'
let tmp .= ','
elseif attribute_style == 'html'
let tmp .= ' '
endif
endif
let Val = substitute(Val, '\${cursor}', '', '')
let tmp .= ' :' . attr . ' => "' . Val . '"'
if attribute_style == 'hash'
let tmp .= ' :' . attr . ' => "' . Val . '"'
elseif attribute_style == 'html'
let tmp .= attr . '="' . Val . '"'
end
endif
endif
endfor
if len(tmp)
let str .= parentheses[0] . tmp . ' '. parentheses[1]
if attribute_style == 'hash'
let str .= '{' . tmp . ' }'
elseif attribute_style == 'html'
let str .= '(' . tmp . ')'
end
endif
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0
let str .= "/"