parent
49bdf7fa47
commit
23ee20887a
@ -253,7 +253,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{
|
|||||||
let link_text = a:link_text
|
let link_text = a:link_text
|
||||||
|
|
||||||
" if link is schemeless add wikiN: scheme
|
" if link is schemeless add wikiN: scheme
|
||||||
if link_text !~# g:vimwiki_rxSchemeUrl
|
if link_text !~# vimwiki#vars#get_global('rxSchemeUrl')
|
||||||
let link_text = 'wiki'.source_wiki.':'.link_text
|
let link_text = 'wiki'.source_wiki.':'.link_text
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{
|
|||||||
|
|
||||||
|
|
||||||
" extract scheme
|
" extract scheme
|
||||||
let link_infos.scheme = matchstr(link_text, g:vimwiki_rxSchemeUrlMatchScheme)
|
let link_infos.scheme = matchstr(link_text, vimwiki#vars#get_global('rxSchemeUrlMatchScheme'))
|
||||||
if link_infos.scheme == '' || link_text == ''
|
if link_infos.scheme == '' || link_text == ''
|
||||||
let link_infos.filename = '' " malformed link
|
let link_infos.filename = '' " malformed link
|
||||||
return link_infos
|
return link_infos
|
||||||
@ -276,7 +276,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{
|
|||||||
let link_infos.filename = link_text " unknown scheme, may be a weblink
|
let link_infos.filename = link_text " unknown scheme, may be a weblink
|
||||||
return link_infos
|
return link_infos
|
||||||
endif
|
endif
|
||||||
let link_text = matchstr(link_text, g:vimwiki_rxSchemeUrlMatchUrl)
|
let link_text = matchstr(link_text, vimwiki#vars#get_global('rxSchemeUrlMatchUrl'))
|
||||||
|
|
||||||
let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+' ||
|
let is_wiki_link = link_infos.scheme =~# '\mwiki\d\+' ||
|
||||||
\ link_infos.scheme ==# 'diary'
|
\ link_infos.scheme ==# 'diary'
|
||||||
|
@ -1417,8 +1417,8 @@ function! s:convert_file(path_html, wikifile) "{{{
|
|||||||
" prepare constants for s:safe_html_line()
|
" prepare constants for s:safe_html_line()
|
||||||
let s:lt_pattern = '<'
|
let s:lt_pattern = '<'
|
||||||
let s:gt_pattern = '>'
|
let s:gt_pattern = '>'
|
||||||
if g:vimwiki_valid_html_tags != ''
|
if vimwiki#vars#get_global('valid_html_tags') != ''
|
||||||
let tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
let tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
|
||||||
let s:lt_pattern = '\c<\%(/\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!'
|
let s:lt_pattern = '\c<\%(/\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?>\)\@!'
|
||||||
let s:gt_pattern = '\c\%(</\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>'
|
let s:gt_pattern = '\c\%(</\?\%('.tags.'\)\%(\s\{-1}\S\{-}\)\{-}/\?\)\@<!>'
|
||||||
endif
|
endif
|
||||||
|
@ -127,8 +127,8 @@ function! vimwiki#path#mkdir(path, ...) "{{{
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let path = vimwiki#path#chomp_slash(path)
|
let path = vimwiki#path#chomp_slash(path)
|
||||||
if vimwiki#u#is_windows() && !empty(g:vimwiki_w32_dir_enc)
|
if vimwiki#u#is_windows() && !empty(vimwiki#vars#get_global('w32_dir_enc'))
|
||||||
let path = iconv(path, &enc, g:vimwiki_w32_dir_enc)
|
let path = iconv(path, &enc, vimwiki#vars#get_global('w32_dir_enc'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:0 && a:1 && input("Vimwiki: Make new directory: "
|
if a:0 && a:1 && input("Vimwiki: Make new directory: "
|
||||||
|
@ -47,6 +47,39 @@ function! s:populate_global_variables()
|
|||||||
let g:vimwiki_global_vars[key] = g:vimwiki_{key}
|
let g:vimwiki_global_vars[key] = g:vimwiki_{key}
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
" non-configurable global variables
|
||||||
|
|
||||||
|
" Scheme regexes should be defined even if syntax file is not loaded yet cause users should be
|
||||||
|
" able to <leader>w<leader>w without opening any vimwiki file first
|
||||||
|
let g:vimwiki_global_vars['schemes'] = 'wiki\d\+,diary,local'
|
||||||
|
let g:vimwiki_global_vars['web_schemes1'] = 'http,https,file,ftp,gopher,telnet,nntp,ldap,rsync'.
|
||||||
|
\ ',imap,pop,irc,ircs,cvs,svn,svn+ssh,git,ssh,fish,sftp'
|
||||||
|
let web_schemes2 = 'mailto,news,xmpp,sip,sips,doi,urn,tel'
|
||||||
|
|
||||||
|
let rx_schemes = '\%('.
|
||||||
|
\ join(split(g:vimwiki_global_vars['schemes'], '\s*,\s*'), '\|').'\|'.
|
||||||
|
\ join(split(g:vimwiki_global_vars['web_schemes1'], '\s*,\s*'), '\|').'\|'.
|
||||||
|
\ join(split(web_schemes2, '\s*,\s*'), '\|').
|
||||||
|
\ '\)'
|
||||||
|
|
||||||
|
let g:vimwiki_global_vars['rxSchemeUrl'] = rx_schemes.':.*'
|
||||||
|
let g:vimwiki_global_vars['rxSchemeUrlMatchScheme'] = '\zs'.rx_schemes.'\ze:.*'
|
||||||
|
let g:vimwiki_global_vars['rxSchemeUrlMatchUrl'] = rx_schemes.':\zs.*\ze'
|
||||||
|
|
||||||
|
" match URL for common protocols; see http://en.wikipedia.org/wiki/URI_scheme
|
||||||
|
" http://tools.ietf.org/html/rfc3986
|
||||||
|
let rxWebProtocols =
|
||||||
|
\ '\%('.
|
||||||
|
\ '\%('.
|
||||||
|
\ '\%('.join(split(g:vimwiki_global_vars['web_schemes1'], '\s*,\s*'), '\|').'\):'.
|
||||||
|
\ '\%(//\)'.
|
||||||
|
\ '\)'.
|
||||||
|
\ '\|'.
|
||||||
|
\ '\%('.join(split(web_schemes2, '\s*,\s*'), '\|').'\):'.
|
||||||
|
\ '\)'
|
||||||
|
|
||||||
|
let g:vimwiki_global_vars['rxWeblinkUrl'] = rxWebProtocols . '\S\{-1,}'. '\%(([^ \t()]*)\)\='
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -363,26 +363,6 @@ call s:default('list', [s:vimwiki_defaults])
|
|||||||
|
|
||||||
call s:default('current_idx', 0)
|
call s:default('current_idx', 0)
|
||||||
|
|
||||||
" Scheme regexes should be defined even if syntax file is not loaded yet
|
|
||||||
" cause users should be able to <leader>w<leader>w without opening any
|
|
||||||
" vimwiki file first
|
|
||||||
" Scheme regexes {{{
|
|
||||||
call s:default('schemes', 'wiki\d\+,diary,local')
|
|
||||||
call s:default('web_schemes1', 'http,https,file,ftp,gopher,telnet,nntp,ldap,'.
|
|
||||||
\ 'rsync,imap,pop,irc,ircs,cvs,svn,svn+ssh,git,ssh,fish,sftp')
|
|
||||||
call s:default('web_schemes2', 'mailto,news,xmpp,sip,sips,doi,urn,tel')
|
|
||||||
|
|
||||||
let s:rxSchemes = '\%('.
|
|
||||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
|
||||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\|'.
|
|
||||||
\ join(split(g:vimwiki_web_schemes2, '\s*,\s*'), '\|').
|
|
||||||
\ '\)'
|
|
||||||
|
|
||||||
call s:default('rxSchemeUrl', s:rxSchemes.':.*')
|
|
||||||
call s:default('rxSchemeUrlMatchScheme', '\zs'.s:rxSchemes.'\ze:.*')
|
|
||||||
call s:default('rxSchemeUrlMatchUrl', s:rxSchemes.':\zs.*\ze')
|
|
||||||
" scheme regexes }}}
|
|
||||||
|
|
||||||
for s:idx in range(len(g:vimwiki_list))
|
for s:idx in range(len(g:vimwiki_list))
|
||||||
call Validate_wiki_options(s:idx)
|
call Validate_wiki_options(s:idx)
|
||||||
endfor
|
endfor
|
||||||
|
@ -22,27 +22,6 @@ endif
|
|||||||
" ...
|
" ...
|
||||||
"endif
|
"endif
|
||||||
|
|
||||||
" LINKS: assume this is common to all syntaxes "{{{
|
|
||||||
|
|
||||||
" LINKS: WebLinks {{{
|
|
||||||
" match URL for common protocols;
|
|
||||||
" see http://en.wikipedia.org/wiki/URI_scheme http://tools.ietf.org/html/rfc3986
|
|
||||||
let g:vimwiki_rxWebProtocols = ''.
|
|
||||||
\ '\%('.
|
|
||||||
\ '\%('.
|
|
||||||
\ '\%('.join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\):'.
|
|
||||||
\ '\%(//\)'.
|
|
||||||
\ '\)'.
|
|
||||||
\ '\|'.
|
|
||||||
\ '\%('.join(split(g:vimwiki_web_schemes2, '\s*,\s*'), '\|').'\):'.
|
|
||||||
\ '\)'
|
|
||||||
"
|
|
||||||
let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
|
|
||||||
\ '\S\{-1,}'. '\%(([^ \t()]*)\)\='
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
call vimwiki#u#reload_regexes()
|
call vimwiki#u#reload_regexes()
|
||||||
|
|
||||||
" LINKS: setup of larger regexes {{{
|
" LINKS: setup of larger regexes {{{
|
||||||
@ -155,7 +134,7 @@ let g:vimwiki_rxWikiInclSuffix1 = g:vimwiki_rxWikiInclArgs.
|
|||||||
" the whitespace.
|
" the whitespace.
|
||||||
" Stuart, could you check it with markdown templated links? [](http://...), as
|
" Stuart, could you check it with markdown templated links? [](http://...), as
|
||||||
" the last bracket is the part of URL now?
|
" the last bracket is the part of URL now?
|
||||||
let g:vimwiki_rxWeblink = '\<'. g:vimwiki_rxWeblinkUrl . '\S*'
|
let g:vimwiki_rxWeblink = '\<'. vimwiki#vars#get_global('rxWeblinkUrl') . '\S*'
|
||||||
" 0a) match URL within URL
|
" 0a) match URL within URL
|
||||||
let g:vimwiki_rxWeblinkMatchUrl = g:vimwiki_rxWeblink
|
let g:vimwiki_rxWeblinkMatchUrl = g:vimwiki_rxWeblink
|
||||||
" 0b) match DESCRIPTION within URL
|
" 0b) match DESCRIPTION within URL
|
||||||
@ -256,8 +235,8 @@ call s:add_target_syntax_ON(g:vimwiki_rxWeblink, 'VimwikiLink')
|
|||||||
" WikiLink
|
" WikiLink
|
||||||
" All remaining schemes are highlighted automatically
|
" All remaining schemes are highlighted automatically
|
||||||
let s:rxSchemes = '\%('.
|
let s:rxSchemes = '\%('.
|
||||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
\ join(split(vimwiki#vars#get_global('schemes'), '\s*,\s*'), '\|').'\|'.
|
||||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
\ join(split(vimwiki#vars#get_global('web_schemes1'), '\s*,\s*'), '\|').
|
||||||
\ '\):'
|
\ '\):'
|
||||||
|
|
||||||
" a) match [[nonwiki-scheme-URL]]
|
" a) match [[nonwiki-scheme-URL]]
|
||||||
|
@ -297,8 +297,8 @@ call s:add_target_syntax_ON(g:vimwiki_rxWeblink1, 'VimwikiWeblink1')
|
|||||||
" WikiLink
|
" WikiLink
|
||||||
" All remaining schemes are highlighted automatically
|
" All remaining schemes are highlighted automatically
|
||||||
let s:rxSchemes = '\%('.
|
let s:rxSchemes = '\%('.
|
||||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
\ join(split(vimwiki#vars#get_global('schemes'), '\s*,\s*'), '\|').'\|'.
|
||||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
\ join(split(vimwiki#vars#get_global('web_schemes1'), '\s*,\s*'), '\|').
|
||||||
\ '\):'
|
\ '\):'
|
||||||
|
|
||||||
" a) match [nonwiki-scheme-URL]
|
" a) match [nonwiki-scheme-URL]
|
||||||
|
Loading…
Reference in New Issue
Block a user