Test for links_space_char #1132

This commit is contained in:
Tinmarino
2021-06-08 17:14:43 -04:00
parent 725709ba80
commit 760cab232d
2 changed files with 18 additions and 0 deletions
+3
View File
@@ -2739,11 +2739,14 @@ function! s:normalize_link_syntax_v() abort
" Replace file extension " Replace file extension
let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr')) let file_extension = vimwiki#vars#get_wikilocal('ext', vimwiki#vars#get_bufferlocal('wiki_nr'))
let link = s:safesubstitute(link, '__FileExtension__', file_extension , '') let link = s:safesubstitute(link, '__FileExtension__', file_extension , '')
" Replace space characters " Replace space characters
let sc = vimwiki#vars#get_wikilocal('links_space_char') let sc = vimwiki#vars#get_wikilocal('links_space_char')
let link = substitute(link, '\s', sc, 'g') let link = substitute(link, '\s', sc, 'g')
" Replace description (used for markdown) " Replace description (used for markdown)
let link = s:safesubstitute(link, '__LinkDescription__', visual_selection, '') let link = s:safesubstitute(link, '__LinkDescription__', visual_selection, '')
" Remove newlines " Remove newlines
let link = substitute(link, '\n', '', '') let link = substitute(link, '\n', '', '')
+15
View File
@@ -1,4 +1,19 @@
# Test variable management (should be small) # Test variable management (should be small)
Given vimwiki (abc def ghi jkl #1132):
abc def ghi jkl
Do (vee<CR>):
:call SetSyntax('markdown')\<CR>
:call vimwiki#vars#set_wikilocal('links_space_char', '_')\<CR>
vee\<CR>
Expect (underscores in link url not in description):
[abc def](abc_def) ghi jkl
Execute (restore):
call vimwiki#vars#set_wikilocal('links_space_char', ' ')
# Issue #980 # Issue #980
# #
# brennen commenting these out 2021-03-29 per @tinmarino: # brennen commenting these out 2021-03-29 per @tinmarino: