mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-08 03:24:45 +08:00
anchorizeURL.
This commit is contained in:
@@ -534,11 +534,13 @@ function! zencoding#anchorizeURL(flag)
|
|||||||
let content = substitute(content, '<!--.\{-}-->', '', 'g')
|
let content = substitute(content, '<!--.\{-}-->', '', 'g')
|
||||||
let title = matchstr(content, mx)
|
let title = matchstr(content, mx)
|
||||||
|
|
||||||
|
let type = zencoding#getFileType()
|
||||||
|
let rtype = len(globpath(&rtp, 'autoload/zencoding/lang/'.type.'.vim')) ? type : 'html'
|
||||||
if a:flag == 0
|
if a:flag == 0
|
||||||
let a = zencoding#lang#html#parseTag('<a>')
|
let a = zencoding#lang#html#parseTag('<a>')
|
||||||
let a.attr.href = url
|
let a.attr.href = url
|
||||||
let a.value = '{' . title . '}'
|
let a.value = '{' . title . '}'
|
||||||
let expand = zencoding#toString(a, 'html', 0, [])
|
let expand = zencoding#toString(a, rtype, 0, [])
|
||||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||||
else
|
else
|
||||||
let body = zencoding#util#getTextFromHTML(content)
|
let body = zencoding#util#getTextFromHTML(content)
|
||||||
@@ -556,11 +558,11 @@ function! zencoding#anchorizeURL(flag)
|
|||||||
let cite = zencoding#lang#html#parseTag('<cite>')
|
let cite = zencoding#lang#html#parseTag('<cite>')
|
||||||
let cite.value = '{' . url . '}'
|
let cite.value = '{' . url . '}'
|
||||||
call add(blockquote.child, cite)
|
call add(blockquote.child, cite)
|
||||||
let expand = zencoding#toString(blockquote, 'html', 0, [])
|
let expand = zencoding#toString(blockquote, rtype, 0, [])
|
||||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||||
|
endif
|
||||||
let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '')
|
let indent = substitute(getline('.'), '^\(\s*\).*', '\1', '')
|
||||||
let expand = substitute(expand, "\n", "\n" . indent, 'g')
|
let expand = substitute(expand, "\n", "\n" . indent, 'g')
|
||||||
endif
|
|
||||||
call zencoding#util#setContent(block, expand)
|
call zencoding#util#setContent(block, expand)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user