Set default list_margin=0 for markdown
This commit is contained in:
parent
cd3e3d238b
commit
7ad0ad36dc
@ -497,6 +497,14 @@ function! s:normalize_wikilocal_settings() abort
|
|||||||
if wiki_settings.syntax ==# 'mediawiki'
|
if wiki_settings.syntax ==# 'mediawiki'
|
||||||
let wiki_settings.syntax = 'media'
|
let wiki_settings.syntax = 'media'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if wiki_settings.syntax ==# 'markdown'
|
||||||
|
" default list margin to 0
|
||||||
|
let wiki_settings.list_margin = 0
|
||||||
|
else
|
||||||
|
let wiki_settings.list_margin = -1
|
||||||
|
endif
|
||||||
|
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -7,12 +7,6 @@ Execute (Copy Wiki's Resources):
|
|||||||
# 1 VimwikiGenerateLinks
|
# 1 VimwikiGenerateLinks
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
Execute (New Command):
|
|
||||||
Log "1. Testing VimwikiGenerateLinks"
|
|
||||||
set sw=4
|
|
||||||
AssertEqual 4, &sw
|
|
||||||
|
|
||||||
|
|
||||||
Given (Void):
|
Given (Void):
|
||||||
|
|
||||||
Execute (Goto markdown resource wiki):
|
Execute (Goto markdown resource wiki):
|
||||||
@ -24,16 +18,16 @@ Execute (Edit Test file / VimwikiGenerateLinks):
|
|||||||
AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
|
AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
|
||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
VimwikiGenerateLinks
|
VimwikiGenerateLinks
|
||||||
|
|
||||||
Expect (The links with a header):
|
Expect (The links with a header):
|
||||||
|
|
||||||
|
|
||||||
# Generated Links
|
# Generated Links
|
||||||
|
|
||||||
- [Buzz Bozz](buzz_bozz)
|
- [Buzz Bozz](buzz_bozz)
|
||||||
- [Test Wiki](index)
|
- [Test Wiki](index)
|
||||||
|
|
||||||
Do (Save Test.md && Re-GenerateLinks):
|
Do (Save Test.md && Re-GenerateLinks):
|
||||||
:edit $HOME/testmarkdown/Test.md\<CR>
|
:edit $HOME/testmarkdown/Test.md\<CR>
|
||||||
@ -42,13 +36,13 @@ Do (Save Test.md && Re-GenerateLinks):
|
|||||||
:VimwikiGenerateLinks\<CR>
|
:VimwikiGenerateLinks\<CR>
|
||||||
|
|
||||||
Expect (The links with a header with file Test):
|
Expect (The links with a header with file Test):
|
||||||
|
|
||||||
|
|
||||||
# Generated Links
|
# Generated Links
|
||||||
|
|
||||||
- [Generated Links](Test)
|
- [Generated Links](Test)
|
||||||
- [Buzz Bozz](buzz_bozz)
|
- [Buzz Bozz](buzz_bozz)
|
||||||
- [Test Wiki](index)
|
- [Test Wiki](index)
|
||||||
|
|
||||||
|
|
||||||
# 2 VimwikiDiaryGenerateLinks
|
# 2 VimwikiDiaryGenerateLinks
|
||||||
@ -80,20 +74,20 @@ Do (Edit diary.md && GenerateDiaryLinks):
|
|||||||
|
|
||||||
Expect (diary index generated):
|
Expect (diary index generated):
|
||||||
# Diary
|
# Diary
|
||||||
|
|
||||||
## 2019
|
## 2019
|
||||||
|
|
||||||
### December
|
### December
|
||||||
|
|
||||||
- [2019-12-10](2019-12-10)
|
- [2019-12-10](2019-12-10)
|
||||||
|
|
||||||
### July
|
### July
|
||||||
|
|
||||||
- [informative title](2019-07-13)
|
- [informative title](2019-07-13)
|
||||||
|
|
||||||
### March
|
### March
|
||||||
|
|
||||||
- [2019-03-01](2019-03-01)
|
- [2019-03-01](2019-03-01)
|
||||||
|
|
||||||
|
|
||||||
Execute (Clean):
|
Execute (Clean):
|
||||||
@ -105,4 +99,5 @@ Execute (Clean):
|
|||||||
|
|
||||||
|
|
||||||
Include: vader_includes/vader_teardown.vader
|
Include: vader_includes/vader_teardown.vader
|
||||||
# vim: sw=2 ft=conf foldmethod=indent foldlevel=30 foldignore=
|
|
||||||
|
" vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
|
||||||
|
@ -10,7 +10,7 @@ Given vimwiki (Headings):
|
|||||||
random text
|
random text
|
||||||
### Header 1.1.1
|
### Header 1.1.1
|
||||||
random text
|
random text
|
||||||
|
|
||||||
# Header 2
|
# Header 2
|
||||||
### Header 2.1.1
|
### Header 2.1.1
|
||||||
|
|
||||||
@ -24,11 +24,11 @@ Execute (VimwikiTOC):
|
|||||||
Expect (With a TOC sw=8):
|
Expect (With a TOC sw=8):
|
||||||
# Contents
|
# Contents
|
||||||
|
|
||||||
- [Header 1](#Header 1)
|
- [Header 1](#Header 1)
|
||||||
- [Header 1.1](#Header 1#Header 1.1)
|
- [Header 1.1](#Header 1#Header 1.1)
|
||||||
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
||||||
- [Header 2](#Header 2)
|
- [Header 2](#Header 2)
|
||||||
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
||||||
|
|
||||||
# Header 1
|
# Header 1
|
||||||
random text
|
random text
|
||||||
@ -47,11 +47,11 @@ Execute (Set sw=4 && VimwikiTOC):
|
|||||||
Expect (With a TOC sw=4):
|
Expect (With a TOC sw=4):
|
||||||
# Contents
|
# Contents
|
||||||
|
|
||||||
- [Header 1](#Header 1)
|
- [Header 1](#Header 1)
|
||||||
- [Header 1.1](#Header 1#Header 1.1)
|
- [Header 1.1](#Header 1#Header 1.1)
|
||||||
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
||||||
- [Header 2](#Header 2)
|
- [Header 2](#Header 2)
|
||||||
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
||||||
|
|
||||||
# Header 1
|
# Header 1
|
||||||
random text
|
random text
|
||||||
@ -75,11 +75,11 @@ Execute (VimwikiTOC):
|
|||||||
Expect (Brand new TOC):
|
Expect (Brand new TOC):
|
||||||
# Contents
|
# Contents
|
||||||
|
|
||||||
- [Header 1](#Header 1)
|
- [Header 1](#Header 1)
|
||||||
- [Header 1.1](#Header 1#Header 1.1)
|
- [Header 1.1](#Header 1#Header 1.1)
|
||||||
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
||||||
- [Header 2](#Header 2)
|
- [Header 2](#Header 2)
|
||||||
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
||||||
|
|
||||||
# Header 1
|
# Header 1
|
||||||
random text
|
random text
|
||||||
@ -99,11 +99,11 @@ Execute (Let toc_header = Sommaire && VimwikiTOC):
|
|||||||
Expect (Append a Sommaire && Leave Contents alone):
|
Expect (Append a Sommaire && Leave Contents alone):
|
||||||
# Sommaire
|
# Sommaire
|
||||||
|
|
||||||
- [Header 1](#Header 1)
|
- [Header 1](#Header 1)
|
||||||
- [Header 1.1](#Header 1#Header 1.1)
|
- [Header 1.1](#Header 1#Header 1.1)
|
||||||
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
||||||
- [Header 2](#Header 2)
|
- [Header 2](#Header 2)
|
||||||
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
||||||
|
|
||||||
# Header 1
|
# Header 1
|
||||||
random text
|
random text
|
||||||
@ -127,11 +127,11 @@ Execute (VimwikiTOC):
|
|||||||
Expect (Brand new TOC with sommaire):
|
Expect (Brand new TOC with sommaire):
|
||||||
# Sommaire
|
# Sommaire
|
||||||
|
|
||||||
- [Header 1](#Header 1)
|
- [Header 1](#Header 1)
|
||||||
- [Header 1.1](#Header 1#Header 1.1)
|
- [Header 1.1](#Header 1#Header 1.1)
|
||||||
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
- [Header 1.1.1](#Header 1#Header 1.1#Header 1.1.1)
|
||||||
- [Header 2](#Header 2)
|
- [Header 2](#Header 2)
|
||||||
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
- [Header 2.1.1](#Header 2#Header 2.1.1)
|
||||||
|
|
||||||
# Header 1
|
# Header 1
|
||||||
random text
|
random text
|
||||||
@ -145,4 +145,5 @@ Expect (Brand new TOC with sommaire):
|
|||||||
|
|
||||||
|
|
||||||
Include: vader_includes/vader_teardown.vader
|
Include: vader_includes/vader_teardown.vader
|
||||||
# vim: sw=2 ft=conf foldmethod=indent foldlevel=30 foldignore=
|
|
||||||
|
" vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
|
||||||
|
105
test/list_margin.vader
Normal file
105
test/list_margin.vader
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
Include: vader_includes/vader_setup.vader
|
||||||
|
|
||||||
|
Execute (Create temp directory):
|
||||||
|
silent execute '!mkdir -p $HOME/list_margin/'
|
||||||
|
cd $HOME/list_margin
|
||||||
|
|
||||||
|
Execute (Create wiki files):
|
||||||
|
write page1.wiki
|
||||||
|
write page2.wiki
|
||||||
|
write page3.wiki
|
||||||
|
write page1.mw
|
||||||
|
write page2.mw
|
||||||
|
write page3.mw
|
||||||
|
write page1.md
|
||||||
|
write page2.md
|
||||||
|
write page3.md
|
||||||
|
|
||||||
|
Given vimwiki (Scratch file):
|
||||||
|
|
||||||
|
Execute (Set syntax default):
|
||||||
|
set shiftwidth=8
|
||||||
|
AssertEqual 8, &shiftwidth
|
||||||
|
call SetSyntax('default')
|
||||||
|
|
||||||
|
Execute (Generate Links):
|
||||||
|
VimwikiGenerateLinks
|
||||||
|
|
||||||
|
Expect (Links with default margin):
|
||||||
|
|
||||||
|
|
||||||
|
= Generated Links =
|
||||||
|
- [[page1]]
|
||||||
|
- [[page2]]
|
||||||
|
- [[page3]]
|
||||||
|
|
||||||
|
Execute (Set list margin == 2):
|
||||||
|
call vimwiki#vars#set_wikilocal('list_margin', 2, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||||
|
VimwikiGenerateLinks
|
||||||
|
|
||||||
|
Expect (Links with margin == 2):
|
||||||
|
|
||||||
|
|
||||||
|
= Generated Links =
|
||||||
|
- [[page1]]
|
||||||
|
- [[page2]]
|
||||||
|
- [[page3]]
|
||||||
|
|
||||||
|
Execute (Set syntax media):
|
||||||
|
call SetSyntax('media')
|
||||||
|
|
||||||
|
Execute (Generate Links):
|
||||||
|
VimwikiGenerateLinks
|
||||||
|
|
||||||
|
Expect (Links with default margin):
|
||||||
|
|
||||||
|
|
||||||
|
= Generated Links =
|
||||||
|
* [[page1]]
|
||||||
|
* [[page2]]
|
||||||
|
* [[page3]]
|
||||||
|
|
||||||
|
Execute (Set list margin == 1):
|
||||||
|
call vimwiki#vars#set_wikilocal('list_margin', 1, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||||
|
VimwikiGenerateLinks
|
||||||
|
|
||||||
|
Expect (Links with margin == 1):
|
||||||
|
|
||||||
|
|
||||||
|
= Generated Links =
|
||||||
|
* [[page1]]
|
||||||
|
* [[page2]]
|
||||||
|
* [[page3]]
|
||||||
|
|
||||||
|
Execute (Set syntax markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Generate Links):
|
||||||
|
VimwikiGenerateLinks
|
||||||
|
|
||||||
|
Expect (Links with default margin):
|
||||||
|
|
||||||
|
|
||||||
|
# Generated Links
|
||||||
|
|
||||||
|
- [page1](page1)
|
||||||
|
- [page2](page2)
|
||||||
|
- [page3](page3)
|
||||||
|
|
||||||
|
Execute (Set list margin == 5):
|
||||||
|
call vimwiki#vars#set_wikilocal('list_margin', 5, vimwiki#vars#get_bufferlocal('wiki_nr'))
|
||||||
|
VimwikiGenerateLinks
|
||||||
|
|
||||||
|
Expect (Links with margin == 5):
|
||||||
|
|
||||||
|
|
||||||
|
# Generated Links
|
||||||
|
|
||||||
|
- [page1](page1)
|
||||||
|
- [page2](page2)
|
||||||
|
- [page3](page3)
|
||||||
|
|
||||||
|
Execute (Return to default location & cleanup):
|
||||||
|
cd /testplugin
|
||||||
|
|
||||||
|
Include: vader_includes/vader_teardown.vader
|
Loading…
Reference in New Issue
Block a user