forked from VimPlug/emmet-vim
accept extends type from zen_settings.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" File: zencoding.vim
|
" File: zencoding.vim
|
||||||
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||||
" Last Change: 11-Mar-2010.
|
" Last Change: 12-Mar-2010.
|
||||||
" Version: 0.31
|
" Version: 0.31
|
||||||
" WebPage: http://github.com/mattn/zencoding-vim
|
" WebPage: http://github.com/mattn/zencoding-vim
|
||||||
" Description: vim plugins for HTML and CSS hi-speed coding.
|
" Description: vim plugins for HTML and CSS hi-speed coding.
|
||||||
@@ -1153,9 +1153,9 @@ function! s:zen_toString(...)
|
|||||||
if len(tmp)
|
if len(tmp)
|
||||||
let str .= '{' . tmp . ' }'
|
let str .= '{' . tmp . ' }'
|
||||||
endif
|
endif
|
||||||
if stridx(','.s:zen_settings['html'].empty_elements.',', ','.current.name.',') != -1 && len(current.value) == 0
|
if stridx(','.s:zen_settings.html.empty_elements.',', ','.current.name.',') != -1 && len(current.value) == 0
|
||||||
let str .= "/"
|
let str .= "/"
|
||||||
elseif stridx(','.s:zen_settings['html'].block_elements.',', ','.current.name.',') != -1 && (len(current.child) == 0 && len(current.value) == 0)
|
elseif stridx(','.s:zen_settings.html.block_elements.',', ','.current.name.',') != -1 && (len(current.child) == 0 && len(current.value) == 0)
|
||||||
let str .= '<'
|
let str .= '<'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -1228,6 +1228,9 @@ function! s:zen_getFileType()
|
|||||||
if synIDattr(synID(line("."), col("."), 1), "name") =~ '^xml'
|
if synIDattr(synID(line("."), col("."), 1), "name") =~ '^xml'
|
||||||
let type = 'xml'
|
let type = 'xml'
|
||||||
endif
|
endif
|
||||||
|
if has_key(s:zen_settings, type) && has_key(s:zen_settings[type], 'extends')
|
||||||
|
let type = s:zen_settings[type].extends
|
||||||
|
endif
|
||||||
if len(type) == 0 | let type = 'html' | endif
|
if len(type) == 0 | let type = 'html' | endif
|
||||||
if type == 'xhtml' | let type = 'html' | endif
|
if type == 'xhtml' | let type = 'html' | endif
|
||||||
return type
|
return type
|
||||||
@@ -1385,7 +1388,7 @@ function! s:zen_imageSize()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let current = s:zen_parseTag(content)
|
let current = s:zen_parseTag(content)
|
||||||
let fn = current.attr['src']
|
let fn = current.attr.src
|
||||||
if fn !~ '^\(/\|http\)'
|
if fn !~ '^\(/\|http\)'
|
||||||
let fn = simplify(expand('%:h') . '/' . fn)
|
let fn = simplify(expand('%:h') . '/' . fn)
|
||||||
endif
|
endif
|
||||||
@@ -1418,8 +1421,8 @@ EOF
|
|||||||
if w == -1 && h == -1
|
if w == -1 && h == -1
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let current.attr['width'] = w
|
let current.attr.width = w
|
||||||
let current.attr['height'] = h
|
let current.attr.height = h
|
||||||
let html = s:zen_toString(current, 'html', 1)
|
let html = s:zen_toString(current, 'html', 1)
|
||||||
call s:change_content(img_region, html)
|
call s:change_content(img_region, html)
|
||||||
endfunction
|
endfunction
|
||||||
@@ -1650,7 +1653,7 @@ function! s:zen_anchorizeURL(flag)
|
|||||||
|
|
||||||
if a:flag == 0
|
if a:flag == 0
|
||||||
let a = s:zen_parseTag('<a>')
|
let a = s:zen_parseTag('<a>')
|
||||||
let a.attr['href'] = url
|
let a.attr.href = url
|
||||||
let a.value = '{' . title . '}'
|
let a.value = '{' . title . '}'
|
||||||
let expand = s:zen_toString(a, 'html', 0, '')
|
let expand = s:zen_toString(a, 'html', 0, '')
|
||||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||||
@@ -1661,7 +1664,7 @@ function! s:zen_anchorizeURL(flag)
|
|||||||
|
|
||||||
let blockquote = s:zen_parseTag('<blockquote class="quote">')
|
let blockquote = s:zen_parseTag('<blockquote class="quote">')
|
||||||
let a = s:zen_parseTag('<a>')
|
let a = s:zen_parseTag('<a>')
|
||||||
let a.attr['href'] = url
|
let a.attr.href = url
|
||||||
let a.value = '{' . title . '}'
|
let a.value = '{' . title . '}'
|
||||||
call add(blockquote.child, a)
|
call add(blockquote.child, a)
|
||||||
call add(blockquote.child, s:zen_parseTag('<br/>'))
|
call add(blockquote.child, s:zen_parseTag('<br/>'))
|
||||||
|
|||||||
Reference in New Issue
Block a user