Make auto_tags preserve existing tag section structure

This commit is contained in:
Jiaming Chen
2023-07-03 19:44:54 -07:00
committed by Tinmarino
parent 65b9f0e68b
commit acc92fb648
2 changed files with 111 additions and 43 deletions
+63
View File
@@ -0,0 +1,63 @@
# Test how vimwiki#tags#generate_tags behaves when updating existing tag link sections
Before (Setup test wiki files):
call writefile([":usedtag:", ":othertag:"], expand("~/testmarkdown/Test-Tag-tagged.md"))
edit ~/testmarkdown/Test-Tag-links.md
After (Cleanup files):
%delete
call system("rm $HOME/testmarkdown/.vimwiki_tags")
call system("rm $HOME/testmarkdown/Test-Tag-tagged.md")
call system("rm $HOME/testmarkdown/Test-Tag-links.md")
Do (Create preexisting tag links with unused tag):
I
# Generated Tags\<CR>
\<CR>
## unusedtag\<CR>
\<CR>
## usedtag\<CR>
\<ESC>
:VimwikiRebuildTags!\<CR>
:call vimwiki#tags#generate_tags(0)\<CR>
Expect (Keeps unused tag header):
# Generated Tags
## unusedtag
## usedtag
- [Test-Tag-tagged](Test-Tag-tagged)
Do (Create preexisting tag subheadings out of alphabetical order):
I
# Generated Tags\<CR>
\<CR>
## z\<CR>
\<CR>
## usedtag\<CR>
\<CR>
## a\<CR>
\<CR>
# Other Stuff
\<ESC>
:VimwikiRebuildTags!\<CR>
:call vimwiki#tags#generate_tags(0)\<CR>
Expect (Existing tag subheading order is preserved):
# Generated Tags
## z
## usedtag
- [Test-Tag-tagged](Test-Tag-tagged)
## a
# Other Stuff