mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 10:44:24 +08:00
Changed 'parenthesis' setting to 'attribute_style' setting to allow for choice between 'hash' and 'html'
Updated output to correctly display html-style attributes or hash-style attributes. 'attribute_style' setting defaults to hash but can be updated by the user to use html style attributes
This commit is contained in:
@@ -1671,7 +1671,7 @@ let s:emmet_settings = {
|
||||
\ ."\t%body\n"
|
||||
\ ."\t\t${child}|\n",
|
||||
\ },
|
||||
\ 'parentheses': '{}',
|
||||
\ 'attribute_style': 'hash',
|
||||
\ },
|
||||
\ 'slim': {
|
||||
\ 'indentation': ' ',
|
||||
|
||||
@@ -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 .= "/"
|
||||
|
||||
Reference in New Issue
Block a user