mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-07 19:24:27 +08:00
camelcase.
This commit is contained in:
@@ -435,17 +435,17 @@ function! zencoding#toggleComment()
|
|||||||
let curpos = getpos('.')
|
let curpos = getpos('.')
|
||||||
let mx = '<\%#[^>]*>'
|
let mx = '<\%#[^>]*>'
|
||||||
while 1
|
while 1
|
||||||
let block = zencoding#util#search_region('<!--', '-->')
|
let block = zencoding#util#searchRegion('<!--', '-->')
|
||||||
if zencoding#util#region_is_valid(block)
|
if zencoding#util#regionIsValid(block)
|
||||||
let block[1][1] += 2
|
let block[1][1] += 2
|
||||||
let content = zencoding#util#get_content(block)
|
let content = zencoding#util#getContent(block)
|
||||||
let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
|
let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
|
||||||
call zencoding#util#change_content(block, content)
|
call zencoding#util#setContent(block, content)
|
||||||
silent! call setpos('.', orgpos)
|
silent! call setpos('.', orgpos)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let block = zencoding#util#search_region('<[^>]', '>')
|
let block = zencoding#util#searchRegion('<[^>]', '>')
|
||||||
if !zencoding#util#region_is_valid(block)
|
if !zencoding#util#regionIsValid(block)
|
||||||
let pos1 = searchpos('<', 'bcW')
|
let pos1 = searchpos('<', 'bcW')
|
||||||
if pos1[0] == 0 && pos1[1] == 0
|
if pos1[0] == 0 && pos1[1] == 0
|
||||||
return
|
return
|
||||||
@@ -455,7 +455,7 @@ function! zencoding#toggleComment()
|
|||||||
endif
|
endif
|
||||||
let pos1 = block[0]
|
let pos1 = block[0]
|
||||||
let pos2 = block[1]
|
let pos2 = block[1]
|
||||||
let content = zencoding#util#get_content(block)
|
let content = zencoding#util#getContent(block)
|
||||||
let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+')
|
let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+')
|
||||||
if tag_name[0] == '/'
|
if tag_name[0] == '/'
|
||||||
call setpos('.', [0, pos1[0], pos1[1], 0])
|
call setpos('.', [0, pos1[0], pos1[1], 0])
|
||||||
@@ -463,12 +463,12 @@ function! zencoding#toggleComment()
|
|||||||
let pos1 = searchpos('>', 'cneW')
|
let pos1 = searchpos('>', 'cneW')
|
||||||
let block = [pos2, pos1]
|
let block = [pos2, pos1]
|
||||||
elseif tag_name =~ '/$'
|
elseif tag_name =~ '/$'
|
||||||
if !zencoding#util#point_in_region(orgpos[1:2], block)
|
if !zencoding#util#pointInRegion(orgpos[1:2], block)
|
||||||
" it's broken tree
|
" it's broken tree
|
||||||
call setpos('.', orgpos)
|
call setpos('.', orgpos)
|
||||||
let block = zencoding#util#search_region('>', '<')
|
let block = zencoding#util#searchRegion('>', '<')
|
||||||
let content = '><!-- ' . zencoding#util#get_content(block)[1:-2] . ' --><'
|
let content = '><!-- ' . zencoding#util#getContent(block)[1:-2] . ' --><'
|
||||||
call zencoding#util#change_content(block, content)
|
call zencoding#util#setContent(block, content)
|
||||||
silent! call setpos('.', orgpos)
|
silent! call setpos('.', orgpos)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -479,13 +479,13 @@ function! zencoding#toggleComment()
|
|||||||
let pos2 = searchpos('>', 'cneW')
|
let pos2 = searchpos('>', 'cneW')
|
||||||
let block = [pos1, pos2]
|
let block = [pos1, pos2]
|
||||||
endif
|
endif
|
||||||
if !zencoding#util#region_is_valid(block)
|
if !zencoding#util#regionIsValid(block)
|
||||||
silent! call setpos('.', orgpos)
|
silent! call setpos('.', orgpos)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
if zencoding#util#point_in_region(curpos[1:2], block)
|
if zencoding#util#pointInRegion(curpos[1:2], block)
|
||||||
let content = '<!-- ' . zencoding#util#get_content(block) . ' -->'
|
let content = '<!-- ' . zencoding#util#getContent(block) . ' -->'
|
||||||
call zencoding#util#change_content(block, content)
|
call zencoding#util#setContent(block, content)
|
||||||
silent! call setpos('.', orgpos)
|
silent! call setpos('.', orgpos)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -500,9 +500,9 @@ function! zencoding#splitJoinTag()
|
|||||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
||||||
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
||||||
if content[-2:] == '/>' && zencoding#util#cursor_in_region(block)
|
if content[-2:] == '/>' && zencoding#util#cursorInRegion(block)
|
||||||
let content = content[:-3] . "></" . tag_name . '>'
|
let content = content[:-3] . "></" . tag_name . '>'
|
||||||
call zencoding#util#change_content(block, content)
|
call zencoding#util#setContent(block, content)
|
||||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -514,10 +514,10 @@ function! zencoding#splitJoinTag()
|
|||||||
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
||||||
endif
|
endif
|
||||||
let block = [pos1, pos2]
|
let block = [pos1, pos2]
|
||||||
let content = zencoding#util#get_content(block)
|
let content = zencoding#util#getContent(block)
|
||||||
if zencoding#util#point_in_region(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||||
let content = matchstr(content, mx)[:-2] . '/>'
|
let content = matchstr(content, mx)[:-2] . '/>'
|
||||||
call zencoding#util#change_content(block, content)
|
call zencoding#util#setContent(block, content)
|
||||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -547,8 +547,8 @@ function! zencoding#removeTag()
|
|||||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
||||||
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
||||||
if content[-2:] == '/>' && zencoding#util#cursor_in_region(block)
|
if content[-2:] == '/>' && zencoding#util#cursorInRegion(block)
|
||||||
call zencoding#util#change_content(block, '')
|
call zencoding#util#setContent(block, '')
|
||||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -560,9 +560,9 @@ function! zencoding#removeTag()
|
|||||||
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
||||||
endif
|
endif
|
||||||
let block = [pos1, pos2]
|
let block = [pos1, pos2]
|
||||||
let content = zencoding#util#get_content(block)
|
let content = zencoding#util#getContent(block)
|
||||||
if zencoding#util#point_in_region(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
if zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||||
call zencoding#util#change_content(block, '')
|
call zencoding#util#setContent(block, '')
|
||||||
call setpos('.', [0, block[0][0], block[0][1], 0])
|
call setpos('.', [0, block[0][0], block[0][1], 0])
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -578,7 +578,7 @@ function! zencoding#removeTag()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#balanceTag(flag) range
|
function! zencoding#balanceTag(flag) range
|
||||||
let vblock = zencoding#util#get_visualblock()
|
let vblock = zencoding#util#getVisualBlock()
|
||||||
if a:flag == -2 || a:flag == 2
|
if a:flag == -2 || a:flag == 2
|
||||||
let curpos = [0, line("'<"), col("'<"), 0]
|
let curpos = [0, line("'<"), col("'<"), 0]
|
||||||
else
|
else
|
||||||
@@ -590,11 +590,11 @@ function! zencoding#balanceTag(flag) range
|
|||||||
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||||
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z0-9:_\-]*\).*$', '\1', '')
|
||||||
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
|
||||||
if !zencoding#util#region_is_valid(block)
|
if !zencoding#util#regionIsValid(block)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
if content[-2:] == '/>' && zencoding#util#point_in_region(curpos[1:2], block)
|
if content[-2:] == '/>' && zencoding#util#pointInRegion(curpos[1:2], block)
|
||||||
call zencoding#util#select_region(block)
|
call zencoding#util#selectRegion(block)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if tag_name[0] == '/'
|
if tag_name[0] == '/'
|
||||||
@@ -608,14 +608,14 @@ function! zencoding#balanceTag(flag) range
|
|||||||
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
||||||
endif
|
endif
|
||||||
let block = [pos1, pos2]
|
let block = [pos1, pos2]
|
||||||
if !zencoding#util#region_is_valid(block)
|
if !zencoding#util#regionIsValid(block)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let content = zencoding#util#get_content(block)
|
let content = zencoding#util#getContent(block)
|
||||||
if a:flag == -2
|
if a:flag == -2
|
||||||
let check = zencoding#util#region_in_region(vblock, block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
let check = zencoding#util#regionInRegion(vblock, block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||||
else
|
else
|
||||||
let check = zencoding#util#point_in_region(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
let check = zencoding#util#pointInRegion(curpos[1:2], block) && content[1:] !~ '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
|
||||||
endif
|
endif
|
||||||
if check
|
if check
|
||||||
if a:flag < 0
|
if a:flag < 0
|
||||||
@@ -631,10 +631,10 @@ function! zencoding#balanceTag(flag) range
|
|||||||
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
|
||||||
endif
|
endif
|
||||||
let block = [pos1, pos2]
|
let block = [pos1, pos2]
|
||||||
call zencoding#util#select_region(block)
|
call zencoding#util#selectRegion(block)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if zencoding#util#region_is_valid(block)
|
if zencoding#util#regionIsValid(block)
|
||||||
if a:flag == -2
|
if a:flag == -2
|
||||||
if setpos('.', [0, block[0][0]+1, block[0][1], 0]) == -1
|
if setpos('.', [0, block[0][0]+1, block[0][1], 0]) == -1
|
||||||
break
|
break
|
||||||
@@ -662,14 +662,14 @@ function! zencoding#anchorizeURL(flag)
|
|||||||
let pos1 = searchpos(mx, 'bcnW')
|
let pos1 = searchpos(mx, 'bcnW')
|
||||||
let url = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
let url = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
|
||||||
let block = [pos1, [pos1[0], pos1[1] + len(url) - 1]]
|
let block = [pos1, [pos1[0], pos1[1] + len(url) - 1]]
|
||||||
if !zencoding#util#cursor_in_region(block)
|
if !zencoding#util#cursorInRegion(block)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let mx = '.*<title[^>]*>\s*\zs\([^<]\+\)\ze\s*<\/title[^>]*>.*'
|
let mx = '.*<title[^>]*>\s*\zs\([^<]\+\)\ze\s*<\/title[^>]*>.*'
|
||||||
let content = zencoding#util#get_content_from_url(url, 0)
|
let content = zencoding#util#getContentFromURL(url, 0)
|
||||||
if len(matchstr(content, mx)) == 0
|
if len(matchstr(content, mx)) == 0
|
||||||
let content = zencoding#util#get_content_from_url(url, 1)
|
let content = zencoding#util#getContentFromURL(url, 1)
|
||||||
endif
|
endif
|
||||||
let content = substitute(content, '\r', '', 'g')
|
let content = substitute(content, '\r', '', 'g')
|
||||||
let content = substitute(content, '[ \n]\+', ' ', 'g')
|
let content = substitute(content, '[ \n]\+', ' ', 'g')
|
||||||
@@ -683,7 +683,7 @@ function! zencoding#anchorizeURL(flag)
|
|||||||
let expand = zencoding#toString(a, 'html', 0, [])
|
let expand = zencoding#toString(a, 'html', 0, [])
|
||||||
let expand = substitute(expand, '\${cursor}', '', 'g')
|
let expand = substitute(expand, '\${cursor}', '', 'g')
|
||||||
else
|
else
|
||||||
let body = zencoding#util#get_text_from_html(content)
|
let body = zencoding#util#getTextFromHTML(content)
|
||||||
let body = '{' . substitute(body, '^\(.\{0,100}\).*', '\1', '') . '...}'
|
let body = '{' . substitute(body, '^\(.\{0,100}\).*', '\1', '') . '...}'
|
||||||
|
|
||||||
let blockquote = zencoding#lang#html#parseTag('<blockquote class="quote">')
|
let blockquote = zencoding#lang#html#parseTag('<blockquote class="quote">')
|
||||||
@@ -703,7 +703,7 @@ function! zencoding#anchorizeURL(flag)
|
|||||||
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
|
endif
|
||||||
call zencoding#util#change_content(block, expand)
|
call zencoding#util#setContent(block, expand)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#ExpandWord(abbr, type, orig)
|
function! zencoding#ExpandWord(abbr, type, orig)
|
||||||
|
|||||||
@@ -384,11 +384,11 @@ function! zencoding#lang#html#toString(settings, current, type, inline, filters,
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#lang#html#imageSize()
|
function! zencoding#lang#html#imageSize()
|
||||||
let img_region = zencoding#util#search_region('<img\s', '>')
|
let img_region = zencoding#util#searchRegion('<img\s', '>')
|
||||||
if !zencoding#util#region_is_valid(img_region) || !zencoding#util#cursor_in_region(img_region)
|
if !zencoding#util#regionIsValid(img_region) || !zencoding#util#cursorInRegion(img_region)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let content = zencoding#util#get_content(img_region)
|
let content = zencoding#util#getContent(img_region)
|
||||||
if content !~ '^<img[^><]\+>$'
|
if content !~ '^<img[^><]\+>$'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -408,7 +408,7 @@ function! zencoding#lang#html#imageSize()
|
|||||||
let current.attr.width = width
|
let current.attr.width = width
|
||||||
let current.attr.height = height
|
let current.attr.height = height
|
||||||
let html = zencoding#toString(current, 'html', 1)
|
let html = zencoding#toString(current, 'html', 1)
|
||||||
call zencoding#util#change_content(img_region, html)
|
call zencoding#util#setContent(img_region, html)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#lang#html#parseTag(tag)
|
function! zencoding#lang#html#parseTag(tag)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"==============================================================================
|
"==============================================================================
|
||||||
" region utils
|
" region utils
|
||||||
"==============================================================================
|
"==============================================================================
|
||||||
" delete_content : delete content in region
|
" deleteContent : delete content in region
|
||||||
" if region make from between '<foo>' and '</foo>'
|
" if region make from between '<foo>' and '</foo>'
|
||||||
" --------------------
|
" --------------------
|
||||||
" begin:<foo>
|
" begin:<foo>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
" --------------------
|
" --------------------
|
||||||
" begin::end
|
" begin::end
|
||||||
" --------------------
|
" --------------------
|
||||||
function! zencoding#util#delete_content(region)
|
function! zencoding#util#deleteContent(region)
|
||||||
let lines = getline(a:region[0][0], a:region[1][0])
|
let lines = getline(a:region[0][0], a:region[1][0])
|
||||||
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
||||||
silent! exe "delete ".(a:region[1][0] - a:region[0][0])
|
silent! exe "delete ".(a:region[1][0] - a:region[0][0])
|
||||||
@@ -36,7 +36,7 @@ endfunction
|
|||||||
" bar
|
" bar
|
||||||
" baz:end
|
" baz:end
|
||||||
" --------------------
|
" --------------------
|
||||||
function! zencoding#util#change_content(region, content)
|
function! zencoding#util#setContent(region, content)
|
||||||
let newlines = split(a:content, '\n', 1)
|
let newlines = split(a:content, '\n', 1)
|
||||||
let oldlines = getline(a:region[0][0], a:region[1][0])
|
let oldlines = getline(a:region[0][0], a:region[1][0])
|
||||||
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
||||||
@@ -72,7 +72,7 @@ endfunction
|
|||||||
|
|
||||||
" select_region : select region
|
" select_region : select region
|
||||||
" this function make a selection of region
|
" this function make a selection of region
|
||||||
function! zencoding#util#select_region(region)
|
function! zencoding#util#selectRegion(region)
|
||||||
call setpos('.', [0, a:region[1][0], a:region[1][1], 0])
|
call setpos('.', [0, a:region[1][0], a:region[1][1], 0])
|
||||||
normal! v
|
normal! v
|
||||||
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
|
||||||
@@ -80,8 +80,8 @@ endfunction
|
|||||||
|
|
||||||
" point_in_region : check point is in the region
|
" point_in_region : check point is in the region
|
||||||
" this function return 0 or 1
|
" this function return 0 or 1
|
||||||
function! zencoding#util#point_in_region(point, region)
|
function! zencoding#util#pointInRegion(point, region)
|
||||||
if !zencoding#util#region_is_valid(a:region) | return 0 | endif
|
if !zencoding#util#regionIsValid(a:region) | return 0 | endif
|
||||||
if a:region[0][0] > a:point[0] | return 0 | endif
|
if a:region[0][0] > a:point[0] | return 0 | endif
|
||||||
if a:region[1][0] < a:point[0] | return 0 | endif
|
if a:region[1][0] < a:point[0] | return 0 | endif
|
||||||
if a:region[0][0] == a:point[0] && a:region[0][1] > a:point[1] | return 0 | endif
|
if a:region[0][0] == a:point[0] && a:region[0][1] > a:point[1] | return 0 | endif
|
||||||
@@ -91,29 +91,29 @@ endfunction
|
|||||||
|
|
||||||
" cursor_in_region : check cursor is in the region
|
" cursor_in_region : check cursor is in the region
|
||||||
" this function return 0 or 1
|
" this function return 0 or 1
|
||||||
function! zencoding#util#cursor_in_region(region)
|
function! zencoding#util#cursorInRegion(region)
|
||||||
if !zencoding#util#region_is_valid(a:region) | return 0 | endif
|
if !zencoding#util#regionIsValid(a:region) | return 0 | endif
|
||||||
let cur = getpos('.')[1:2]
|
let cur = getpos('.')[1:2]
|
||||||
return zencoding#util#point_in_region(cur, a:region)
|
return zencoding#util#pointInRegion(cur, a:region)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" region_is_valid : check region is valid
|
" region_is_valid : check region is valid
|
||||||
" this function return 0 or 1
|
" this function return 0 or 1
|
||||||
function! zencoding#util#region_is_valid(region)
|
function! zencoding#util#regionIsValid(region)
|
||||||
if a:region[0][0] == 0 || a:region[1][0] == 0 | return 0 | endif
|
if a:region[0][0] == 0 || a:region[1][0] == 0 | return 0 | endif
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" search_region : make region from pattern which is composing start/end
|
" search_region : make region from pattern which is composing start/end
|
||||||
" this function return array of position
|
" this function return array of position
|
||||||
function! zencoding#util#search_region(start, end)
|
function! zencoding#util#searchRegion(start, end)
|
||||||
return [searchpairpos(a:start, '', a:end, 'bcnW'), searchpairpos(a:start, '\%#', a:end, 'nW')]
|
return [searchpairpos(a:start, '', a:end, 'bcnW'), searchpairpos(a:start, '\%#', a:end, 'nW')]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" get_content : get content in region
|
" get_content : get content in region
|
||||||
" this function return string in region
|
" this function return string in region
|
||||||
function! zencoding#util#get_content(region)
|
function! zencoding#util#getContent(region)
|
||||||
if !zencoding#util#region_is_valid(a:region)
|
if !zencoding#util#regionIsValid(a:region)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
let lines = getline(a:region[0][0], a:region[1][0])
|
let lines = getline(a:region[0][0], a:region[1][0])
|
||||||
@@ -128,23 +128,23 @@ endfunction
|
|||||||
|
|
||||||
" region_in_region : check region is in the region
|
" region_in_region : check region is in the region
|
||||||
" this function return 0 or 1
|
" this function return 0 or 1
|
||||||
function! zencoding#util#region_in_region(outer, inner)
|
function! zencoding#util#regionInRegion(outer, inner)
|
||||||
if !zencoding#util#region_is_valid(a:inner) || !zencoding#util#region_is_valid(a:outer)
|
if !zencoding#util#regionIsValid(a:inner) || !zencoding#util#regionIsValid(a:outer)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
return zencoding#util#point_in_region(a:inner[0], a:outer) && zencoding#util#point_in_region(a:inner[1], a:outer)
|
return zencoding#util#pointInRegion(a:inner[0], a:outer) && zencoding#util#pointInRegion(a:inner[1], a:outer)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" get_visualblock : get region of visual block
|
" get_visualblock : get region of visual block
|
||||||
" this function return region of visual block
|
" this function return region of visual block
|
||||||
function! zencoding#util#get_visualblock()
|
function! zencoding#util#getVisualBlock()
|
||||||
return [[line("'<"), col("'<")], [line("'>"), col("'>")]]
|
return [[line("'<"), col("'<")], [line("'>"), col("'>")]]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"==============================================================================
|
"==============================================================================
|
||||||
" html utils
|
" html utils
|
||||||
"==============================================================================
|
"==============================================================================
|
||||||
function! zencoding#util#get_content_from_url(url, utf8)
|
function! zencoding#util#getContentFromURL(url, utf8)
|
||||||
silent! new
|
silent! new
|
||||||
if a:utf8
|
if a:utf8
|
||||||
silent! exec '0r ++enc=utf8 !'.g:zencoding_curl_command.' "'.substitute(a:url, '#.*', '', '').'"'
|
silent! exec '0r ++enc=utf8 !'.g:zencoding_curl_command.' "'.substitute(a:url, '#.*', '', '').'"'
|
||||||
@@ -156,7 +156,7 @@ function! zencoding#util#get_content_from_url(url, utf8)
|
|||||||
return ret
|
return ret
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! zencoding#util#get_text_from_html(buf)
|
function! zencoding#util#getTextFromHTML(buf)
|
||||||
let threshold_len = 100
|
let threshold_len = 100
|
||||||
let threshold_per = 0.1
|
let threshold_per = 0.1
|
||||||
let buf = a:buf
|
let buf = a:buf
|
||||||
|
|||||||
Reference in New Issue
Block a user