2020-07-30 05:29:03 +02:00
|
|
|
# Automatic link generation
|
|
|
|
# Related to:
|
|
|
|
# - wiki file discovery
|
|
|
|
# - buffer list insertion (see: vimwiki#base#update_listing_in_buffer)
|
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
|
|
|
|
Execute (Copy Wiki's Resources):
|
|
|
|
Log "Start: Copy Resources"
|
|
|
|
call CopyResources()
|
|
|
|
|
2020-07-27 20:47:19 +02:00
|
|
|
# 1 VimwikiGenerateLinks {{{1
|
2019-12-15 05:37:28 +01:00
|
|
|
##########################
|
2020-07-27 20:47:19 +02:00
|
|
|
# Wiki Syntax {{{2
|
|
|
|
#################
|
|
|
|
|
|
|
|
Execute (Log):
|
|
|
|
Log 'Wiki Syntax'
|
|
|
|
|
|
|
|
Given (Void):
|
|
|
|
|
|
|
|
Execute (VimwikiGenerateLinks):
|
|
|
|
edit $HOME/testwiki/Test.wiki
|
|
|
|
VimwikiGenerateLinks
|
|
|
|
|
|
|
|
Expect (The links with a header):
|
|
|
|
|
|
|
|
|
|
|
|
= Generated Links =
|
|
|
|
- [[buzz_bozz]]
|
|
|
|
- [[index]]
|
|
|
|
|
|
|
|
Execute (VimwikiGenerateLinks x 2):
|
|
|
|
edit $HOME/testwiki/Test.wiki
|
|
|
|
VimwikiGenerateLinks
|
|
|
|
call append('$', 'Last Line')
|
|
|
|
VimwikiGenerateLinks
|
|
|
|
|
|
|
|
Expect (The links with a header):
|
|
|
|
|
|
|
|
|
|
|
|
= Generated Links =
|
|
|
|
- [[buzz_bozz]]
|
|
|
|
- [[index]]
|
|
|
|
|
|
|
|
Execute (Clean Test.wiki):
|
|
|
|
call DeleteFile('$HOME/testwiki/Test.wiki')
|
|
|
|
|
|
|
|
|
|
|
|
# Markdown Syntax {{{2
|
|
|
|
#################
|
|
|
|
|
|
|
|
Execute (Log):
|
|
|
|
Log 'Markdown Syntax'
|
2019-12-15 05:37:28 +01:00
|
|
|
|
|
|
|
Given (Void):
|
|
|
|
|
|
|
|
Execute (Goto markdown resource wiki):
|
|
|
|
VimwikiIndex 2
|
|
|
|
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
|
|
|
|
|
|
|
Execute (Edit Test file / VimwikiGenerateLinks):
|
|
|
|
edit $HOME/testmarkdown/Test.md
|
|
|
|
AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
|
|
|
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
|
|
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
|
|
|
VimwikiGenerateLinks
|
|
|
|
|
|
|
|
Expect (The links with a header):
|
2019-12-21 17:09:16 +01:00
|
|
|
|
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
# Generated Links
|
|
|
|
|
2019-12-21 17:09:16 +01:00
|
|
|
- [Buzz Bozz](buzz_bozz)
|
|
|
|
- [Test Wiki](index)
|
2019-12-15 05:37:28 +01:00
|
|
|
|
|
|
|
Do (Save Test.md && Re-GenerateLinks):
|
|
|
|
:edit $HOME/testmarkdown/Test.md\<CR>
|
2020-07-27 20:47:19 +02:00
|
|
|
:call WriteMe()\<CR>
|
|
|
|
:VimwikiGenerateLinks\<CR>
|
2019-12-15 05:37:28 +01:00
|
|
|
:VimwikiGenerateLinks\<CR>
|
|
|
|
|
|
|
|
Expect (The links with a header with file Test):
|
2019-12-21 17:09:16 +01:00
|
|
|
|
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
# Generated Links
|
|
|
|
|
2019-12-21 17:09:16 +01:00
|
|
|
- [Generated Links](Test)
|
|
|
|
- [Buzz Bozz](buzz_bozz)
|
|
|
|
- [Test Wiki](index)
|
2019-12-15 05:37:28 +01:00
|
|
|
|
2020-07-27 20:47:19 +02:00
|
|
|
Execute (Clean: Remove Test.md):
|
|
|
|
call DeleteFile('$HOME/testmarkdown/Test.md')
|
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
|
2020-07-27 20:47:19 +02:00
|
|
|
# 2 VimwikiDiaryGenerateLinks {{{1
|
2019-12-15 05:37:28 +01:00
|
|
|
#############################
|
|
|
|
|
2020-07-27 20:47:19 +02:00
|
|
|
# Wiki Syntax {{{1
|
|
|
|
#################
|
|
|
|
|
|
|
|
Execute (Log):
|
|
|
|
Log 'Wiki Syntax'
|
|
|
|
|
|
|
|
Do (Create diary files):
|
|
|
|
:edit $HOME/testwiki/diary/2019-12-10.wiki\<Cr>
|
|
|
|
:call append('$', 'Content')\<Cr>
|
|
|
|
:call WriteMe()\<Cr>
|
|
|
|
:edit $HOME/testwiki/diary/2019-07-13.wiki\<Cr>
|
|
|
|
:call append('$', 'Content')\<Cr>
|
|
|
|
:call WriteMe()\<Cr>
|
|
|
|
:edit $HOME/testwiki/diary/2019-03-01.wiki\<Cr>
|
|
|
|
:call append('$', 'Content')\<Cr>
|
|
|
|
:call WriteMe()\<Cr>
|
|
|
|
|
|
|
|
Do (Edit diary.wiki && GenerateDiaryLinks):
|
|
|
|
:edit $HOME/testwiki/diary/diary.wiki\<CR>
|
|
|
|
:VimwikiDiaryGenerateLinks\<CR>
|
|
|
|
|
|
|
|
Expect (diary index generated):
|
|
|
|
= Diary =
|
|
|
|
== 2020 ==
|
|
|
|
|
|
|
|
=== July ===
|
|
|
|
- [[2020-07-25|day 4]]
|
|
|
|
- [[2020-07-24|day 3]]
|
|
|
|
- [[2020-07-23|Day 2]]
|
|
|
|
- [[2020-07-22]]
|
|
|
|
|
|
|
|
== 2019 ==
|
|
|
|
|
|
|
|
=== December ===
|
|
|
|
- [[2019-12-10]]
|
|
|
|
|
|
|
|
=== July ===
|
|
|
|
- [[2019-07-13]]
|
|
|
|
|
|
|
|
=== March ===
|
|
|
|
- [[2019-03-01]]
|
|
|
|
|
|
|
|
Execute (Clean):
|
|
|
|
Log "End: Clean"
|
|
|
|
call DeleteFile('$HOME/testwiki/diary/2019-12-10.wiki')
|
|
|
|
call DeleteFile('$HOME/testwiki/diary/2019-07-13.wiki')
|
|
|
|
call DeleteFile('$HOME/testwiki/diary/2019-03-01.wiki')
|
|
|
|
Log "End: Reset shiftwidth to the default: 8"
|
|
|
|
|
|
|
|
# Wiki Markdown {{{1
|
|
|
|
#################
|
|
|
|
|
|
|
|
Execute (Log):
|
|
|
|
Log 'Markdown Syntax'
|
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
Execute (New Command):
|
|
|
|
Log "2. Testing VimwikiDiaryGenerateLinks TODO"
|
|
|
|
set sw=4
|
|
|
|
AssertEqual 4, &sw
|
|
|
|
|
|
|
|
Do (Edit diary/2019-12-10):
|
|
|
|
:edit $HOME/testmarkdown/diary/2019-12-10.md\<CR>
|
|
|
|
iinformative content\<Esc>
|
|
|
|
:call WriteMe()\<CR>
|
|
|
|
|
|
|
|
Do (Edit and save diary/2019-07-13):
|
|
|
|
:edit $HOME/testmarkdown/diary/2019-07-13.md\<CR>
|
|
|
|
i# informative title\<Esc>
|
|
|
|
:call WriteMe()\<CR>
|
|
|
|
|
|
|
|
Do (Edit and save diary/2018-03-01):
|
|
|
|
:edit $HOME/testmarkdown/diary/2019-03-01.md\<CR>
|
|
|
|
:call WriteMe()\<CR>
|
|
|
|
|
|
|
|
|
|
|
|
Do (Edit diary.md && GenerateDiaryLinks):
|
|
|
|
:edit $HOME/testmarkdown/diary/diary.md\<CR>
|
|
|
|
:VimwikiDiaryGenerateLinks\<CR>
|
|
|
|
|
|
|
|
Expect (diary index generated):
|
|
|
|
# Diary
|
2019-12-21 17:09:16 +01:00
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
## 2019
|
2019-12-21 17:09:16 +01:00
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
### December
|
2019-12-21 17:09:16 +01:00
|
|
|
|
|
|
|
- [2019-12-10](2019-12-10)
|
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
### July
|
2019-12-21 17:09:16 +01:00
|
|
|
|
|
|
|
- [informative title](2019-07-13)
|
|
|
|
|
2019-12-15 05:37:28 +01:00
|
|
|
### March
|
2019-12-21 17:09:16 +01:00
|
|
|
|
|
|
|
- [2019-03-01](2019-03-01)
|
2019-12-15 05:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
Execute (Clean):
|
|
|
|
Log "End: Clean"
|
2020-07-27 20:47:19 +02:00
|
|
|
call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md')
|
|
|
|
call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md')
|
|
|
|
call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md')
|
|
|
|
Log "End: Reset shiftwidth to the default: 8"
|
|
|
|
set sw&
|
2019-12-15 05:37:28 +01:00
|
|
|
|
2020-07-27 20:47:19 +02:00
|
|
|
# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
|