Clean URLs that don't have slashes
Will fix normalization of links like [[local:./foo.txt]] Also, allow schemes to end with a number, so that e.g. [[wiki1:foo]] will normalize as expected.
This commit is contained in:
parent
5605f285c1
commit
f639c0a342
@ -1861,7 +1861,8 @@ endfunction
|
||||
|
||||
function! s:clean_url(url)
|
||||
" remove protocol and tld
|
||||
let url = substitute(a:url, '^\a\+://', '', '')
|
||||
let url = substitute(a:url, '^\a\+\d*:', '', '')
|
||||
let url = substitute(url, '^//', '', '')
|
||||
let url = substitute(url, '^\([^/]\+\).\a\{2,4}/', '\1/', '')
|
||||
let url = split(url, '/\|=\|-\|&\|?\|\.')
|
||||
let url = filter(url, 'v:val !=# ""')
|
||||
|
Loading…
Reference in New Issue
Block a user