Lazy: Link with only '-' do not work
This commit is contained in:
parent
b4cb7f7ab6
commit
972594829e
@ -1383,7 +1383,7 @@ function! vimwiki#base#follow_link(split, ...) abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else " cursor is not on a link
|
||||||
if a:0 >= 3
|
if a:0 >= 3
|
||||||
execute 'normal! '.a:3
|
execute 'normal! '.a:3
|
||||||
elseif vimwiki#vars#get_global('create_link')
|
elseif vimwiki#vars#get_global('create_link')
|
||||||
@ -2138,7 +2138,7 @@ function! s:clean_url(url) abort
|
|||||||
let url_l = split(url, '/\|=\|-\|&\|?\|\.')
|
let url_l = split(url, '/\|=\|-\|&\|?\|\.')
|
||||||
" case only a '-'
|
" case only a '-'
|
||||||
if url_l == []
|
if url_l == []
|
||||||
let url_l = [url]
|
return ''
|
||||||
endif
|
endif
|
||||||
let url_l = filter(url_l, 'v:val !=# ""')
|
let url_l = filter(url_l, 'v:val !=# ""')
|
||||||
if url_l[0] ==# 'www'
|
if url_l[0] ==# 'www'
|
||||||
@ -2174,8 +2174,10 @@ function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
|||||||
let url = substitute(url, '\'.vimwiki#vars#get_wikilocal('ext').'$', '', '')
|
let url = substitute(url, '\'.vimwiki#vars#get_wikilocal('ext').'$', '', '')
|
||||||
endif
|
endif
|
||||||
let descr = matchstr(a:str, a:rxDesc)
|
let descr = matchstr(a:str, a:rxDesc)
|
||||||
|
" Try to clean, do not work if bad link
|
||||||
if descr ==# ''
|
if descr ==# ''
|
||||||
let descr = s:clean_url(url)
|
let descr = s:clean_url(url)
|
||||||
|
if descr ==# '' | return url | endif
|
||||||
endif
|
endif
|
||||||
let lnk = s:safesubstitute(a:template, '__LinkDescription__', descr, '')
|
let lnk = s:safesubstitute(a:template, '__LinkDescription__', descr, '')
|
||||||
let lnk = s:safesubstitute(lnk, '__LinkUrl__', url, '')
|
let lnk = s:safesubstitute(lnk, '__LinkUrl__', url, '')
|
||||||
|
Loading…
Reference in New Issue
Block a user