Make tag links relative to current file #794 (#1162)

Also add a vader test case and update the changelog as well as the list
of contributors.

Co-authored-by: Tinmarino <tinmarino@gmail.com>
This commit is contained in:
Philipp Oberdiek
2021-12-18 16:11:01 +01:00
committed by GitHub
parent ee31d45553
commit c19e63b1e9
3 changed files with 78 additions and 0 deletions
+74
View File
@@ -205,3 +205,77 @@ Execute (Clean Test-Tag and .vimwiki_tags -1 ):
call DeleteHiddenBuffers()
# vim: sw=2:foldlevel=30:foldmethod=marker:
######################################################################
Execute (Check first tags file):
call system("mkdir -p $HOME/testmarkdown/subdir1/subdir11")
edit $HOME/testmarkdown/Test-Tag-1.md
AssertEqual $HOME . '/testmarkdown/Test-Tag-1.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Build first tags file):
:edit $HOME/testmarkdown/Test-Tag-1.md\<Cr>
ggI
# A Header\<Cr>
:header-tag-1:\<Cr>
\<Cr>
# Another Header\<Cr>
:header-tag-2:\<Cr>
\<Cr>
:standalone-tag-1:
\<Esc>
:write\<Cr>
:VimwikiRebuildTags!\<CR>
Execute (Check second tags file):
edit $HOME/testmarkdown/subdir1/Test-Tag-2.md
AssertEqual $HOME . '/testmarkdown/subdir1/Test-Tag-2.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Build second tags file):
:edit $HOME/testmarkdown/subdir1/Test-Tag-2.md\<Cr>
ggI
# A Header\<Cr>
:header-tag-1:\<Cr>
\<Cr>
# Another Header\<Cr>
:header-tag-2:\<Cr>
\<Cr>
:standalone-tag-1:
\<Esc>
:write\<Cr>
:VimwikiRebuildTags!\<CR>
Execute (Build tag links in third file):
edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md
AssertEqual $HOME . '/testmarkdown/subdir1/subdir11/Test-Tag-Links.md', expand('%')
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
VimwikiGenerateTagLinks
write
Expect (Tag links relative to current file):
# Generated Tags
## header-tag-1
- [a-header](../../Test-Tag-1#a-header)
- [a-header](../Test-Tag-2#a-header)
## header-tag-2
- [another-header](../../Test-Tag-1#another-header)
- [another-header](../Test-Tag-2#another-header)
## standalone-tag-1
- [standalone-tag-1](../../Test-Tag-1#standalone-tag-1)
- [standalone-tag-1](../Test-Tag-2#standalone-tag-1)
Execute (Clean relative tag setup):
call system("rm -rf $HOME/testmarkdown/subdir1")
call system("rm $HOME/testmarkdown/Test-Tag-1.md")