commit 466bdcd4e85351515a9479c6332dca0dc8f8f9b4
parent af12065e9260b17dc32233aeb535e97d263e4b55
Author: Rane Brown <rane.brown@gmail.com>
Date: Fri, 12 Jul 2019 13:52:23 -0600
Don't reuse variable in s:clean_url (sticky type checking)
Versions of Vim prior to 7.4.1546 had sticky type checking which
prevented a variables type from changing. Fixes #715.
Diffstat:
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim
@@ -2065,18 +2065,18 @@ function! s:clean_url(url)
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 !=# ""')
- if url[0] == "www"
- let url = url[1:]
+ let url_l = split(url, '/\|=\|-\|&\|?\|\.')
+ let url_l = filter(url_l, 'v:val !=# ""')
+ if url_l[0] == "www"
+ let url_l = url_l[1:]
endif
- if url[-1] =~ '^\(htm\|html\|php\)$'
- let url = url[0:-2]
+ if url_l[-1] =~ '^\(htm\|html\|php\)$'
+ let url_l = url_l[0:-2]
endif
" remove words consisting of only hexadecimal digits or non-word characters
- let url = filter(url, 'v:val !~ "^\\A\\{4,}$"')
- let url = filter(url, 'v:val !~ "^\\x\\{4,}$" || v:val !~ "\\d"')
- return join(url, " ")
+ let url_l = filter(url_l, 'v:val !~ "^\\A\\{4,}$"')
+ let url_l = filter(url_l, 'v:val !~ "^\\x\\{4,}$" || v:val !~ "\\d"')
+ return join(url_l, " ")
endfunction
diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt
@@ -3518,6 +3518,8 @@ Removed:~
point.
Fixed:~
+ * Issue #715: s:clean_url is compatible with vim pre 7.4.1546 (sticky type
+ checking)
* Issue #729: Normalize links uses relative paths in diary pages for
Markdown syntax. This previously only worked for the default syntax.
* Modify horizontal rule (thematic-breaks) syntax for markdown.