Fix: Broken TOC links format when using default syntax (Issue #981)
- Not normalising for default - SetExt header missed a `^` in the regex so mateched the trailing === of === head3 ===
This commit is contained in:
@ -7,6 +7,12 @@
|
||||
# Otherwise the bash script is freezing
|
||||
|
||||
|
||||
### Wiki {{{1
|
||||
###############
|
||||
|
||||
|
||||
### Markdown {{{1
|
||||
###############
|
||||
|
||||
|
||||
Given vimwiki (a):
|
||||
|
@ -6,29 +6,80 @@
|
||||
# TODO (10min) test if g:vimwiki_to_header well readen
|
||||
# TODO (10min) test vimviki_toc_link_format
|
||||
# TODO (1h) test if really wiki dependant (for 2 diffrent wikis)
|
||||
#
|
||||
# Doc: from #664:
|
||||
# -- 1. It downcases the string => OK: from previous big collection
|
||||
# -- 2. remove anything that is not a letter, number, space or hyphen (see the source for how Unicode is handled) => from 'bad characters'
|
||||
# -- 3. changes any space to a hyphen => OK: from previous big
|
||||
# -- 4. If that is not unique, add "-1", "-2", "-3",... to make it unique => TODO not implemented
|
||||
#
|
||||
#
|
||||
# TODO if link in heading
|
||||
#Given vimwiki (Two same heading {{{1):
|
||||
# # Pre [link](anything no parenthesis) Post
|
||||
#
|
||||
#Execute (Set syntax markdown && Set sw=8):
|
||||
# call SetSyntax('markdown')
|
||||
# set sw=8
|
||||
# VimwikiTOC
|
||||
#
|
||||
#Expect (Suffix -1 and -2):
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# Start {{{1
|
||||
|
||||
Given vimwiki (Wiki with spaces {{{1):
|
||||
= h1 h2 h3 h4 =
|
||||
|
||||
Execute (Toc and enter (alpha)):
|
||||
call SetSyntax('default')
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
AssertEqual -1, vimwiki#vars#get_wikilocal('list_margin')
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Toc alpha):
|
||||
= Contents =
|
||||
- [[#h1 h2 h3 h4]]
|
||||
|
||||
= h1 h2 h3 h4 =
|
||||
|
||||
Given vimwiki (Wiki with bad characters {{{1):
|
||||
= h!@$%^&() =
|
||||
|
||||
Execute (Toc and beta):
|
||||
call SetSyntax('default')
|
||||
file wiki.wiki
|
||||
VimwikiTOC
|
||||
|
||||
Expect (Toc and jumpes well):
|
||||
= Contents =
|
||||
- [[#h!@$%^&()]]
|
||||
|
||||
= h!@$%^&() =
|
||||
|
||||
|
||||
Given vimwiki (One word headings (#981) {{{1):
|
||||
= head1 =
|
||||
== head2 ==
|
||||
=== head3 ===
|
||||
|
||||
Execute (Wiki: toc_link_format=1 (to restore) VimwikiTOC x 1):
|
||||
set sw=2
|
||||
let vimwiki_toc_link_format = 1
|
||||
call ReloadVimwiki()
|
||||
call SetSyntax('default')
|
||||
VimwikiTOC
|
||||
|
||||
|
||||
Expect(Headinds TOC one word (1)):
|
||||
= Contents =
|
||||
- [[#head1|head1]]
|
||||
- [[#head1#head2|head2]]
|
||||
- [[#head1#head2#head3|head3]]
|
||||
|
||||
= head1 =
|
||||
== head2 ==
|
||||
=== head3 ===
|
||||
|
||||
Execute (Wiki: toc_link_format=0 (restoring default) VimwikiTOC x 1):
|
||||
let vimwiki_toc_link_format = 0
|
||||
call ReloadVimwiki()
|
||||
call SetSyntax('default')
|
||||
VimwikiTOC
|
||||
|
||||
Expect(Headinds TOC one word (0)):
|
||||
= Contents =
|
||||
- [[#head1]]
|
||||
- [[#head2]]
|
||||
- [[#head3]]
|
||||
|
||||
= head1 =
|
||||
== head2 ==
|
||||
=== head3 ===
|
||||
|
||||
|
||||
Execute (Clean wiki TOC):
|
||||
|
||||
|
||||
Given vimwiki (One heading: May delete last line (#910) {{{1):
|
||||
# Basic-title
|
||||
|
@ -37,6 +37,7 @@ Expect (Links with default margin):
|
||||
Execute (Set list margin == 2):
|
||||
call vimwiki#vars#set_wikilocal('list_margin', 2, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with margin == 2):
|
||||
|
||||
@ -52,6 +53,7 @@ Execute (Set syntax media):
|
||||
|
||||
Execute (Generate Links):
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with default margin):
|
||||
|
||||
@ -64,6 +66,7 @@ Expect (Links with default margin):
|
||||
Execute (Set list margin == 1):
|
||||
call vimwiki#vars#set_wikilocal('list_margin', 1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with margin == 1):
|
||||
|
||||
@ -92,6 +95,7 @@ Expect (Links with default margin):
|
||||
Execute (Set list margin == 5):
|
||||
call vimwiki#vars#set_wikilocal('list_margin', 5, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
VimwikiGenerateLinks
|
||||
call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||
|
||||
Expect (Links with margin == 5):
|
||||
|
||||
|
Reference in New Issue
Block a user