forked from VimPlug/emmet-vim
Merge pull request #217 from conraddecker/master
Changed 'parenthesis' setting to 'attribute_style' setting
This commit is contained in:
@@ -1671,7 +1671,7 @@ let s:emmet_settings = {
|
|||||||
\ ."\t%body\n"
|
\ ."\t%body\n"
|
||||||
\ ."\t\t${child}|\n",
|
\ ."\t\t${child}|\n",
|
||||||
\ },
|
\ },
|
||||||
\ 'parentheses': '{}',
|
\ 'attribute_style': 'hash',
|
||||||
\ },
|
\ },
|
||||||
\ 'slim': {
|
\ 'slim': {
|
||||||
\ 'indentation': ' ',
|
\ 'indentation': ' ',
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function! emmet#lang#haml#toString(settings, current, type, inline, filters, ite
|
|||||||
let itemno = a:itemno
|
let itemno = a:itemno
|
||||||
let indent = emmet#getIndentation(type)
|
let indent = emmet#getIndentation(type)
|
||||||
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
|
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 str = ""
|
||||||
|
|
||||||
let comment_indent = ''
|
let comment_indent = ''
|
||||||
@@ -33,7 +33,11 @@ function! emmet#lang#haml#toString(settings, current, type, inline, filters, ite
|
|||||||
endif
|
endif
|
||||||
let Val = current.attr[attr]
|
let Val = current.attr[attr]
|
||||||
if type(Val) == 2 && Val == function('emmet#types#true')
|
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
|
else
|
||||||
if dollar_expr
|
if dollar_expr
|
||||||
while Val =~ '\$\([^#{]\|$\)'
|
while Val =~ '\$\([^#{]\|$\)'
|
||||||
@@ -47,14 +51,28 @@ function! emmet#lang#haml#toString(settings, current, type, inline, filters, ite
|
|||||||
elseif attr == 'class' && len(valtmp) > 0
|
elseif attr == 'class' && len(valtmp) > 0
|
||||||
let str .= '.' . substitute(Val, ' ', '.', 'g')
|
let str .= '.' . substitute(Val, ' ', '.', 'g')
|
||||||
else
|
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 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
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if len(tmp)
|
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
|
endif
|
||||||
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0
|
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0
|
||||||
let str .= "/"
|
let str .= "/"
|
||||||
|
|||||||
Reference in New Issue
Block a user