Create a function fo reload the plugin. Fix setting of mediwiki syntax.
Also adds a few additional link creation tests.
This commit is contained in:
parent
86cad979e5
commit
e68592b8ef
@ -5,6 +5,11 @@ Given vimwiki (Text that is not a wikilink):
|
|||||||
www.google.com
|
www.google.com
|
||||||
https://www.google.com
|
https://www.google.com
|
||||||
multiple words
|
multiple words
|
||||||
|
let's
|
||||||
|
let's
|
||||||
|
file.wiki
|
||||||
|
file.md
|
||||||
|
file.mw
|
||||||
|
|
||||||
Execute (Set syntax to default):
|
Execute (Set syntax to default):
|
||||||
call SetSyntax('default')
|
call SetSyntax('default')
|
||||||
@ -20,12 +25,28 @@ Do (Create links default syntax):
|
|||||||
j
|
j
|
||||||
v$
|
v$
|
||||||
\<Enter>
|
\<Enter>
|
||||||
|
j
|
||||||
|
v$
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
|
||||||
Expect (Vimwiki links):
|
Expect (Vimwiki links):
|
||||||
[[test]]
|
[[test]]
|
||||||
[[www.google.com]]
|
[[www.google.com]]
|
||||||
[[https://www.google.com]]
|
[[https://www.google.com]]
|
||||||
[[multiple words]]
|
[[multiple words]]
|
||||||
|
[[let's]]
|
||||||
|
[[let]]'s
|
||||||
|
[[file.wiki]]
|
||||||
|
[[file.md]]
|
||||||
|
[[file.mw]]
|
||||||
|
|
||||||
Execute (Set syntax to markdown):
|
Execute (Set syntax to markdown):
|
||||||
call SetSyntax('markdown')
|
call SetSyntax('markdown')
|
||||||
@ -41,15 +62,31 @@ Do (Create links markdown syntax):
|
|||||||
j
|
j
|
||||||
v$
|
v$
|
||||||
\<Enter>
|
\<Enter>
|
||||||
|
j
|
||||||
|
v$
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
|
||||||
Expect (Markdown links):
|
Expect (Markdown links):
|
||||||
[test](test)
|
[test](test)
|
||||||
[www.google.com](www.google.com)
|
[www.google.com](www.google.com)
|
||||||
[https://www.google.com](https://www.google.com)
|
[https://www.google.com](https://www.google.com)
|
||||||
[multiple words](multiple words)
|
[multiple words](multiple words)
|
||||||
|
[let's](let's)
|
||||||
|
[let](let)'s
|
||||||
|
[file wiki](file.wiki)
|
||||||
|
[file](file.md)
|
||||||
|
[file mw](file.mw)
|
||||||
|
|
||||||
Execute (Set syntax to mediawiki):
|
Execute (Set syntax to mediawiki):
|
||||||
call SetSyntax('mediawiki')
|
call SetSyntax('media')
|
||||||
|
|
||||||
Do (Create links mediawiki syntax):
|
Do (Create links mediawiki syntax):
|
||||||
\<Enter>
|
\<Enter>
|
||||||
@ -62,11 +99,27 @@ Do (Create links mediawiki syntax):
|
|||||||
j
|
j
|
||||||
v$
|
v$
|
||||||
\<Enter>
|
\<Enter>
|
||||||
|
j
|
||||||
|
v$
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
j
|
||||||
|
\<Enter>
|
||||||
|
|
||||||
Expect (Mediawiki links):
|
Expect (Mediawiki links):
|
||||||
[[test]]
|
[[test]]
|
||||||
[[www.google.com]]
|
[[www.google.com]]
|
||||||
[[https://www.google.com]]
|
[[https://www.google.com]]
|
||||||
[[multiple words]]
|
[[multiple words]]
|
||||||
|
[[let's]]
|
||||||
|
[[let]]'s
|
||||||
|
[[file.wiki]]
|
||||||
|
[[file.md]]
|
||||||
|
[[file.mw]]
|
||||||
|
|
||||||
Include: vader_teardown.vader
|
Include: vader_teardown.vader
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
Before (Setup):
|
Include: vader_setup.vader
|
||||||
|
|
||||||
|
Execute (Set fold method):
|
||||||
let g:vimwiki_folding = 'expr:quick'
|
let g:vimwiki_folding = 'expr:quick'
|
||||||
|
call ReloadVimwiki()
|
||||||
" clear mappings so plugin can be reloaded
|
|
||||||
" this is needed if running manually multiple times
|
|
||||||
nmapclear
|
|
||||||
|
|
||||||
" reload the plugin to set the fold method
|
|
||||||
unlet g:loaded_vimwiki
|
|
||||||
source plugin/vimwiki.vim
|
|
||||||
|
|
||||||
Execute (Expect < 0.5 second delay: Issue #580):
|
Execute (Expect < 0.5 second delay: Issue #580):
|
||||||
" prep
|
" prep
|
||||||
@ -29,3 +24,9 @@ Execute (Expect < 0.5 second delay: Issue #580):
|
|||||||
" verify
|
" verify
|
||||||
Log 'Elapsed time = ' . string(end)
|
Log 'Elapsed time = ' . string(end)
|
||||||
Assert end < 0.5, 'Took longer than expected: ' . string(end) . ' seconds'
|
Assert end < 0.5, 'Took longer than expected: ' . string(end) . ' seconds'
|
||||||
|
|
||||||
|
Execute (Reset variables):
|
||||||
|
let g:vimwiki_folding = ''
|
||||||
|
call ReloadVimwiki()
|
||||||
|
|
||||||
|
Include: vader_teardown.vader
|
||||||
|
@ -9,10 +9,11 @@ Before (Define functions):
|
|||||||
let ext = 'wiki'
|
let ext = 'wiki'
|
||||||
elseif a:vw_syn ==# 'markdown'
|
elseif a:vw_syn ==# 'markdown'
|
||||||
let ext = 'md'
|
let ext = 'md'
|
||||||
elseif a:vw_syn ==# 'mediawiki'
|
elseif a:vw_syn ==# 'media'
|
||||||
let ext = 'mw'
|
let ext = 'mw'
|
||||||
else
|
else
|
||||||
Log 'Inavlid syntax ' . a:vw_syn . ' in SetSyntax()'
|
Log 'ERROR: Invalid syntax "' . a:vw_syn . '" in SetSyntax()'
|
||||||
|
Log 'NOTE: function only accepts "media" for setting mediawiki syntax'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let path = expand('%:p:h')
|
let path = expand('%:p:h')
|
||||||
@ -23,4 +24,17 @@ Before (Define functions):
|
|||||||
call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
|
call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
|
||||||
call vimwiki#vars#set_bufferlocal('wiki_nr', g:wiki_nr)
|
call vimwiki#vars#set_bufferlocal('wiki_nr', g:wiki_nr)
|
||||||
let g:wiki_nr += 1
|
let g:wiki_nr += 1
|
||||||
|
|
||||||
|
" verify syntax was set correctly
|
||||||
|
Assert vimwiki#vars#get_wikilocal('syntax') ==# a:vw_syn, 'ERROR: Vimwiki syntax not set correctly.'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" reload plugin to change settings
|
||||||
|
function! ReloadVimwiki()
|
||||||
|
" clear mappings so plugin can be reloaded
|
||||||
|
" this is needed if running manually multiple times
|
||||||
|
nmapclear
|
||||||
|
|
||||||
|
unlet g:loaded_vimwiki
|
||||||
|
source plugin/vimwiki.vim
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
Execute (Cleanup):
|
Execute (Cleanup):
|
||||||
delfunction SetSyntax
|
delfunction SetSyntax
|
||||||
|
delfunction ReloadVimwiki
|
||||||
unlet g:wiki_nr
|
unlet g:wiki_nr
|
||||||
|
Loading…
Reference in New Issue
Block a user