vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 966a94bd477f3b10ae7b66693508274c9aaf1288
parent d5c6cee5eb3526027c5079e9f672c25ab299f0e0
Author: Nick Borden <nrborden@gmail.com>
Date:   Mon, 28 May 2018 12:24:29 -0700

Diary links should use markdown syntax when appropriate (#500)

When markdown syntax is enabled, generated links should use markdown
link syntax.

Fix #499
Diffstat:
Mautoload/vimwiki/diary.vim | 24++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/autoload/vimwiki/diary.vim b/autoload/vimwiki/diary.vim @@ -150,17 +150,21 @@ function! s:format_diary() \ '__Header__', s:get_month_name(month), '')) for [fl, cap] in s:sort(items(g_files[year][month])) - if empty(cap) - let entry = substitute(vimwiki#vars#get_global('WikiLinkTemplate1'), - \ '__LinkUrl__', fl, '') - let entry = substitute(entry, '__LinkDescription__', cap, '') - call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry) - else - let entry = substitute(vimwiki#vars#get_global('WikiLinkTemplate2'), - \ '__LinkUrl__', fl, '') - let entry = substitute(entry, '__LinkDescription__', cap, '') - call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry) + let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2') + + if vimwiki#vars#get_wikilocal('syntax') == 'markdown' + let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template') + + if empty(cap) " When using markdown syntax, we should ensure we always have a link description. + let cap = fl + endif + elseif empty(cap) + let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1') endif + + let entry = substitute(link_tpl, '__LinkUrl__', fl, '') + let entry = substitute(entry, '__LinkDescription__', cap, '') + call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry) endfor endfor