Diary links should use markdown syntax when appropriate (#500)
When markdown syntax is enabled, generated links should use markdown link syntax. Fix #499
This commit is contained in:
parent
d5c6cee5eb
commit
966a94bd47
@ -150,17 +150,21 @@ function! s:format_diary()
|
|||||||
\ '__Header__', s:get_month_name(month), ''))
|
\ '__Header__', s:get_month_name(month), ''))
|
||||||
|
|
||||||
for [fl, cap] in s:sort(items(g_files[year][month]))
|
for [fl, cap] in s:sort(items(g_files[year][month]))
|
||||||
if empty(cap)
|
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
|
||||||
let entry = substitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
|
|
||||||
\ '__LinkUrl__', fl, '')
|
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
|
||||||
let entry = substitute(entry, '__LinkDescription__', cap, '')
|
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
||||||
call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry)
|
|
||||||
else
|
if empty(cap) " When using markdown syntax, we should ensure we always have a link description.
|
||||||
let entry = substitute(vimwiki#vars#get_global('WikiLinkTemplate2'),
|
let cap = fl
|
||||||
\ '__LinkUrl__', fl, '')
|
|
||||||
let entry = substitute(entry, '__LinkDescription__', cap, '')
|
|
||||||
call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry)
|
|
||||||
endif
|
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
|
||||||
|
|
||||||
endfor
|
endfor
|
||||||
|
Loading…
Reference in New Issue
Block a user