mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 03:04:27 +08:00
fixed title. and trim strings.
This commit is contained in:
@@ -1531,6 +1531,7 @@ function! s:getTextFromHTML(buf)
|
|||||||
let buf = a:buf
|
let buf = a:buf
|
||||||
|
|
||||||
let buf = strpart(buf, stridx(buf, '</head>'))
|
let buf = strpart(buf, stridx(buf, '</head>'))
|
||||||
|
let buf = substitute(buf, '<script>.\{-}</script>', '', 'g')
|
||||||
let res = ''
|
let res = ''
|
||||||
let max = 0
|
let max = 0
|
||||||
let mx = '\(<td[^>]\{-}>\)\|\(<\/td>\)\|\(<div[^>]\{-}>\)\|\(<\/div>\)'
|
let mx = '\(<td[^>]\{-}>\)\|\(<\/td>\)\|\(<div[^>]\{-}>\)\|\(<\/div>\)'
|
||||||
@@ -1545,6 +1546,8 @@ function! s:getTextFromHTML(buf)
|
|||||||
let str = substitute(str, ' ', ' ', 'g')
|
let str = substitute(str, ' ', ' ', 'g')
|
||||||
let str = substitute(str, '¥', '\¥', 'g')
|
let str = substitute(str, '¥', '\¥', 'g')
|
||||||
let str = substitute(str, '&', '\&', 'g')
|
let str = substitute(str, '&', '\&', 'g')
|
||||||
|
let str = substitute(str, '^\s*\(.*\)\s*$', '\1', '')
|
||||||
|
let str = substitute(str, '\s\+', ' ', 'g')
|
||||||
let l = len(str)
|
let l = len(str)
|
||||||
if l > threshold_len
|
if l > threshold_len
|
||||||
let per = len(c) / l
|
let per = len(c) / l
|
||||||
@@ -1554,6 +1557,7 @@ function! s:getTextFromHTML(buf)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
let res = substitute(res, '^\s*\(.*\)\s*$', '\1', 'g')
|
||||||
return res
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1576,7 +1580,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, '')
|
||||||
else
|
else
|
||||||
let body = strpart(content, stridx(content, '</head>'))
|
let body = strpart(content, stridx(content, '</head>'))
|
||||||
|
|||||||
Reference in New Issue
Block a user