Initial commit
This commit is contained in:
parent
c8d09d7c9e
commit
eb00d30d9b
@ -197,8 +197,11 @@ function! vimwiki#base#resolve_link(link_text, ...)
|
||||
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||
endif
|
||||
else
|
||||
let ext = fnamemodify(link_text, ':e')
|
||||
if ext == '' " append ext iff one not already present
|
||||
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||
endif
|
||||
endif
|
||||
|
||||
elseif link_infos.scheme ==# 'diary'
|
||||
let link_infos.index = source_wiki
|
||||
@ -350,9 +353,15 @@ function! vimwiki#base#generate_links()
|
||||
for link in links
|
||||
let abs_filepath = vimwiki#path#abs_path_of_link(link)
|
||||
if !s:is_diary_file(abs_filepath)
|
||||
call add(lines, bullet.
|
||||
\ s:safesubstitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
|
||||
\ '__LinkUrl__', link, ''))
|
||||
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
||||
else
|
||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
|
||||
endif
|
||||
|
||||
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', link, '')
|
||||
let entry = s:safesubstitute(entry, '__LinkDescription__', link, '')
|
||||
call add(lines, bullet. entry)
|
||||
endif
|
||||
endfor
|
||||
|
||||
@ -598,7 +607,12 @@ function! s:get_links(wikifile, idx)
|
||||
endif
|
||||
|
||||
let syntax = vimwiki#vars#get_wikilocal('syntax', a:idx)
|
||||
if syntax == 'markdown'
|
||||
let rx_link = vimwiki#vars#get_syntaxlocal('rxWeblink1MatchUrl', syntax)
|
||||
else
|
||||
let rx_link = vimwiki#vars#get_syntaxlocal('wikilink', syntax)
|
||||
endif
|
||||
|
||||
let links = []
|
||||
let lnum = 0
|
||||
|
||||
@ -1870,7 +1884,7 @@ function! vimwiki#base#table_of_contents(create)
|
||||
let bullet = vimwiki#lst#default_symbol().' '
|
||||
for [lvl, link, desc] in complete_header_infos
|
||||
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
|
||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink2Template')
|
||||
else
|
||||
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
|
||||
endif
|
||||
|
@ -168,6 +168,7 @@ function! s:read_global_settings_from_user()
|
||||
\ 'listsyms': {'type': type(''), 'default': ' .oOX', 'min_length': 2},
|
||||
\ 'listsym_rejected': {'type': type(''), 'default': '-', 'length': 1},
|
||||
\ 'map_prefix': {'type': type(''), 'default': '<Leader>w'},
|
||||
\ 'markdown_link_ext': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||
\ 'menu': {'type': type(''), 'default': 'Vimwiki'},
|
||||
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
||||
\ 'table_mappings': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
||||
@ -689,10 +690,17 @@ function! s:populate_extra_markdown_vars()
|
||||
let mkd_syntax.rxWeblink1Prefix = '['
|
||||
let mkd_syntax.rxWeblink1Suffix = ')'
|
||||
let mkd_syntax.rxWeblink1Separator = ']('
|
||||
let mkd_syntax.rxWeblink1Ext = ''
|
||||
if vimwiki#vars#get_global('markdown_link_ext')
|
||||
let mkd_syntax.rxWeblink1Ext = vimwiki#vars#get_wikilocal('ext')
|
||||
endif
|
||||
" [DESCRIPTION](URL)
|
||||
let mkd_syntax.Weblink1Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
|
||||
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'.
|
||||
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. mkd_syntax.rxWeblink1Ext.
|
||||
\ mkd_syntax.rxWeblink1Suffix
|
||||
" [DESCRIPTION](ANCHOR)
|
||||
let mkd_syntax.Weblink2Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
|
||||
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. mkd_syntax.rxWeblink1Suffix
|
||||
|
||||
let valid_chars = '[^\\]'
|
||||
|
||||
@ -705,8 +713,8 @@ function! s:populate_extra_markdown_vars()
|
||||
" 1. [DESCRIPTION](URL)
|
||||
" 1a) match [DESCRIPTION](URL)
|
||||
let mkd_syntax.rxWeblink1 = mkd_syntax.rxWeblink1Prefix.
|
||||
\ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Separator.
|
||||
\ mkd_syntax.rxWeblink1Descr . mkd_syntax.rxWeblink1Suffix
|
||||
\ mkd_syntax.rxWeblink1Descr . mkd_syntax.rxWeblink1Separator.
|
||||
\ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Suffix
|
||||
" 1b) match URL within [DESCRIPTION](URL)
|
||||
let mkd_syntax.rxWeblink1MatchUrl = mkd_syntax.rxWeblink1Prefix.
|
||||
\ mkd_syntax.rxWeblink1Descr. mkd_syntax.rxWeblink1Separator.
|
||||
|
@ -2553,6 +2553,19 @@ Value Description~
|
||||
Default: 1
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_markdown_link_ext*
|
||||
|
||||
Append wiki file extension to links in Markdown. This is needed for
|
||||
compatibility with other Markdown tools.
|
||||
|
||||
Value Description~
|
||||
0 Do not append wiki file extension.
|
||||
1 Append wiki file extension.
|
||||
|
||||
Default: 0
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*VimwikiLinkHandler*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user