Unify path handling -- part 2
This commit is contained in:
parent
8d0d1561c5
commit
12d6265193
@ -185,8 +185,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{
|
|||||||
let link_infos.index = source_wiki
|
let link_infos.index = source_wiki
|
||||||
|
|
||||||
let link_infos.filename =
|
let link_infos.filename =
|
||||||
\ vimwiki#vars#get_wikilocal('path', link_infos.index) .
|
\ vimwiki#vars#get_wikilocal('diary_path', link_infos.index) .
|
||||||
\ vimwiki#vars#get_wikilocal('diary_rel_path', link_infos.index) .
|
|
||||||
\ link_text .
|
\ link_text .
|
||||||
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
elseif (link_infos.scheme ==# 'file' || link_infos.scheme ==# 'local')
|
elseif (link_infos.scheme ==# 'file' || link_infos.scheme ==# 'local')
|
||||||
@ -367,7 +366,7 @@ function! vimwiki#base#find_files(wiki_nr, directories_only)
|
|||||||
if wiki_nr >= 0
|
if wiki_nr >= 0
|
||||||
let root_directory = vimwiki#vars#get_wikilocal('path', wiki_nr)
|
let root_directory = vimwiki#vars#get_wikilocal('path', wiki_nr)
|
||||||
else
|
else
|
||||||
let root_directory = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
|
let root_directory = vimwiki#vars#get_wikilocal('diary_path')
|
||||||
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
endif
|
endif
|
||||||
if a:directories_only
|
if a:directories_only
|
||||||
@ -395,7 +394,7 @@ function! vimwiki#base#get_wikilinks(wiki_nr, also_absolute_links)
|
|||||||
if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
|
if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
let cwd = vimwiki#path#wikify_path(expand('%:p:h'))
|
let cwd = vimwiki#path#wikify_path(expand('%:p:h'))
|
||||||
elseif a:wiki_nr < 0
|
elseif a:wiki_nr < 0
|
||||||
let cwd = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
|
let cwd = vimwiki#vars#get_wikilocal('diary_path')
|
||||||
else
|
else
|
||||||
let cwd = vimwiki#vars#get_wikilocal('path', a:wiki_nr)
|
let cwd = vimwiki#vars#get_wikilocal('path', a:wiki_nr)
|
||||||
endif
|
endif
|
||||||
@ -410,7 +409,7 @@ function! vimwiki#base#get_wikilinks(wiki_nr, also_absolute_links)
|
|||||||
if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
|
if a:wiki_nr == vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
let cwd = vimwiki#vars#get_wikilocal('path')
|
let cwd = vimwiki#vars#get_wikilocal('path')
|
||||||
elseif a:wiki_nr < 0
|
elseif a:wiki_nr < 0
|
||||||
let cwd = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path')
|
let cwd = vimwiki#vars#get_wikilocal('diary_path')
|
||||||
endif
|
endif
|
||||||
let wikifile = fnamemodify(wikifile, ':r') " strip extension
|
let wikifile = fnamemodify(wikifile, ':r') " strip extension
|
||||||
let wikifile = '/'.vimwiki#path#relpath(cwd, wikifile)
|
let wikifile = '/'.vimwiki#path#relpath(cwd, wikifile)
|
||||||
@ -1707,9 +1706,9 @@ endfunction " }}}
|
|||||||
" s:is_diary_file
|
" s:is_diary_file
|
||||||
function! s:is_diary_file(filename) " {{{
|
function! s:is_diary_file(filename) " {{{
|
||||||
let file_path = vimwiki#path#path_norm(a:filename)
|
let file_path = vimwiki#path#path_norm(a:filename)
|
||||||
let rel_path = vimwiki#vars#get_wikilocal('diary_rel_path')
|
let diary_path = vimwiki#path#path_norm(vimwiki#vars#get_wikilocal('diary_path'))
|
||||||
let diary_path = vimwiki#path#path_norm(vimwiki#vars#get_wikilocal('path') . rel_path)
|
return vimwiki#path#equal(vimwiki#vars#get_wikilocal('path'),
|
||||||
return rel_path != ''
|
\ vimwiki#vars#get_wikilocal('diary_path'))
|
||||||
\ && file_path =~# '^'.vimwiki#u#escape(diary_path)
|
\ && file_path =~# '^'.vimwiki#u#escape(diary_path)
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
@ -1739,8 +1738,7 @@ endfunction " }}}
|
|||||||
function! s:normalize_link_in_diary(lnk) " {{{
|
function! s:normalize_link_in_diary(lnk) " {{{
|
||||||
let link = a:lnk . vimwiki#vars#get_wikilocal('ext')
|
let link = a:lnk . vimwiki#vars#get_wikilocal('ext')
|
||||||
let link_wiki = vimwiki#vars#get_wikilocal('path') . '/' . link
|
let link_wiki = vimwiki#vars#get_wikilocal('path') . '/' . link
|
||||||
let link_diary = vimwiki#vars#get_wikilocal('path') . '/'
|
let link_diary = vimwiki#vars#get_wikilocal('diary_path') . '/' . link
|
||||||
\ . vimwiki#vars#get_wikilocal('diary_rel_path') . '/' . link
|
|
||||||
let link_exists_in_diary = filereadable(link_diary)
|
let link_exists_in_diary = filereadable(link_diary)
|
||||||
let link_exists_in_wiki = filereadable(link_wiki)
|
let link_exists_in_wiki = filereadable(link_wiki)
|
||||||
let link_is_date = a:lnk =~# '\d\d\d\d-\d\d-\d\d'
|
let link_is_date = a:lnk =~# '\d\d\d\d-\d\d-\d\d'
|
||||||
@ -1751,8 +1749,10 @@ function! s:normalize_link_in_diary(lnk) " {{{
|
|||||||
let rxDesc = ''
|
let rxDesc = ''
|
||||||
let template = vimwiki#vars#get_global('WikiLinkTemplate1')
|
let template = vimwiki#vars#get_global('WikiLinkTemplate1')
|
||||||
else
|
else
|
||||||
let depth = len(split(vimwiki#vars#get_wikilocal('diary_rel_path'), '/'))
|
let relative_link =
|
||||||
let str = repeat('../', depth) . a:lnk . '|' . a:lnk
|
\ vimwiki#path#relpath(vimwiki#vars#get_wikilocal('diary_path'),
|
||||||
|
\ vimwiki#vars#get_wikilocal('path'))
|
||||||
|
let str = relative_link . a:lnk . '|' . a:lnk
|
||||||
let rxUrl = '^.*\ze|'
|
let rxUrl = '^.*\ze|'
|
||||||
let rxDesc = '|\zs.*$'
|
let rxDesc = '|\zs.*$'
|
||||||
let template = vimwiki#vars#get_global('WikiLinkTemplate2')
|
let template = vimwiki#vars#get_global('WikiLinkTemplate2')
|
||||||
|
@ -22,7 +22,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
function! s:diary_path(...) "{{{
|
function! s:diary_path(...) "{{{
|
||||||
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
|
let idx = a:0 == 0 ? vimwiki#vars#get_bufferlocal('wiki_nr') : a:1
|
||||||
return vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx)
|
return vimwiki#vars#get_wikilocal('diary_path', idx)
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:diary_index(...) "{{{
|
function! s:diary_index(...) "{{{
|
||||||
@ -85,7 +85,7 @@ endfun "}}}
|
|||||||
|
|
||||||
fun! s:get_diary_links() "{{{
|
fun! s:get_diary_links() "{{{
|
||||||
let rx = '^\d\{4}-\d\d-\d\d'
|
let rx = '^\d\{4}-\d\d-\d\d'
|
||||||
let s_files = glob(vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path').'*'.vimwiki#vars#get_wikilocal('ext'))
|
let s_files = glob(vimwiki#vars#get_wikilocal('diary_path') . '*' . vimwiki#vars#get_wikilocal('ext'))
|
||||||
let files = split(s_files, '\n')
|
let files = split(s_files, '\n')
|
||||||
call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"')
|
call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"')
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ function! vimwiki#diary#make_note(wnum, ...) "{{{
|
|||||||
let idx = 0
|
let idx = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx))
|
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('diary_path', idx))
|
||||||
|
|
||||||
if a:0 && a:1 == 1
|
if a:0 && a:1 == 1
|
||||||
let cmd = 'tabedit'
|
let cmd = 'tabedit'
|
||||||
@ -284,7 +284,7 @@ endfunction "}}}
|
|||||||
function vimwiki#diary#calendar_sign(day, month, year) "{{{
|
function vimwiki#diary#calendar_sign(day, month, year) "{{{
|
||||||
let day = s:prefix_zero(a:day)
|
let day = s:prefix_zero(a:day)
|
||||||
let month = s:prefix_zero(a:month)
|
let month = s:prefix_zero(a:month)
|
||||||
let sfile = vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path').
|
let sfile = vimwiki#vars#get_wikilocal('diary_path') .
|
||||||
\ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
|
\ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
|
||||||
return filereadable(expand(sfile))
|
return filereadable(expand(sfile))
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
@ -53,7 +53,7 @@ function! s:default_CSS_full_name(target_dir) " {{{
|
|||||||
return vimwiki#path#join(path, vimwiki#vars#get_wikilocal('css_name'))
|
return vimwiki#path#join(path, vimwiki#vars#get_wikilocal('css_name'))
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" Returns: 1 if it was createt, 0 if it already existed
|
" Returns: 1 if it was created, 0 if it already existed
|
||||||
function! s:create_default_CSS(target_dir) " {{{
|
function! s:create_default_CSS(target_dir) " {{{
|
||||||
let css_full_name = s:default_CSS_full_name(a:target_dir)
|
let css_full_name = s:default_CSS_full_name(a:target_dir)
|
||||||
if vimwiki#path#exists(css_full_name)
|
if vimwiki#path#exists(css_full_name)
|
||||||
|
@ -168,38 +168,43 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
"----------------------------------------------------------
|
||||||
|
" Path manipulation, i.e. do stuff with the paths of (not necessarily existing) files
|
||||||
|
"----------------------------------------------------------
|
||||||
|
|
||||||
"XXX das kann man aber Einheitstesten!
|
|
||||||
" XXX überlegen, ob wir auch n Objekt für Wikilinks machen
|
" The used data types are (with their internal representation)
|
||||||
" Alternativ kann man auch einen Dateipfad als Ordner + Dateinamen modellieren
|
|
||||||
" The used data types are
|
|
||||||
" - directory object: a dictionary with the following entries:
|
" - directory object: a dictionary with the following entries:
|
||||||
" - 'protocoll' -- how to access the file. Supportet are 'scp' or 'file'
|
" - 'protocoll' -- how to access the file. Supported are 'scp' or 'file'
|
||||||
" - 'is_unix' -- 1 if it's supposed to be a unix-like path
|
" - 'is_unix' -- 1 if it's supposed to be a unix-like path
|
||||||
" - 'path' -- a list containing the directory names starting at the root
|
" - 'path' -- a list containing the directory names starting at the root
|
||||||
" - file object: a list [directory_object, file name]
|
" - file object: a list [dir_obj, file name]
|
||||||
" - file segment: representing e.g. a relative path. Is a list where the first
|
" - file segment: representing e.g. a relative path. Is a list where the first
|
||||||
" element is a list of directory names and the second the file name
|
" element is a list of directory names and the second the file name
|
||||||
|
" - directory segment: a list of directory names
|
||||||
|
|
||||||
" create and return a path object from a string. It is assumed that the given
|
|
||||||
" path is abolute and points to a file (not a directory)
|
" create and return a file object from a string. It is assumed that the given
|
||||||
function! vimwiki#path#from_absolute_file(filepath)
|
" path is absolute and points to a file (not a directory)
|
||||||
|
function! vimwiki#path#file_obj(filepath)
|
||||||
let filename = fnamemodify(a:filepath, ':p:t')
|
let filename = fnamemodify(a:filepath, ':p:t')
|
||||||
let path = fnamemodify(a:filepath, ':p:h')
|
let path = fnamemodify(a:filepath, ':p:h')
|
||||||
return [vimwiki#path#from_absolute_dir(path), filename]
|
return [vimwiki#path#dir_obj(path), filename]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#path#from_absolute_dir(filepath)
|
" create and return a dir object from a string. The given path should be
|
||||||
if a:filepath =~# '^scp:'
|
" absolute and point to a directory.
|
||||||
let filepath = a:filepath[4:]
|
function! vimwiki#path#dir_obj(dirpath)
|
||||||
|
if a:dirpath =~# '^scp:'
|
||||||
|
let dirpath = a:dirpath[4:]
|
||||||
let protocoll = 'scp'
|
let protocoll = 'scp'
|
||||||
else
|
else
|
||||||
let filepath = resolve(a:filepath)
|
let dirpath = resolve(a:dirpath)
|
||||||
let protocoll = 'file'
|
let protocoll = 'file'
|
||||||
endif
|
endif
|
||||||
let path = split(vimwiki#path#chomp_slash(filepath), '\m[/\\]', 1)
|
let path = split(vimwiki#path#chomp_slash(dirpath), '\m[/\\]', 1)
|
||||||
let is_unix = filepath[0] ==# '/'
|
let is_unix = dirpath[0] ==# '/'
|
||||||
let result = {
|
let result = {
|
||||||
\ 'is_unix' : is_unix,
|
\ 'is_unix' : is_unix,
|
||||||
\ 'protocoll' : protocoll,
|
\ 'protocoll' : protocoll,
|
||||||
@ -208,43 +213,56 @@ function! vimwiki#path#from_absolute_dir(filepath)
|
|||||||
return result
|
return result
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vimwiki#path#current_file()
|
|
||||||
return vimwiki#path#from_absolute_file(expand('%:p'))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! vimwiki#path#extension(file_object)
|
function! vimwiki#path#extension(file_object)
|
||||||
return fnamemodify(a:file_object[1], ':e')
|
return fnamemodify(a:file_object[1], ':e')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Returns: the dir of the file object as dir object
|
" Returns: the dir of the file object as dir object
|
||||||
function! vimwiki#path#directory(file_object)
|
function! vimwiki#path#directory_of_file(file_object)
|
||||||
return copy(a:file_object[0])
|
return copy(a:file_object[0])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Returns: the file_obj's file name as a string
|
||||||
function! vimwiki#path#filename(file_object)
|
function! vimwiki#path#filename(file_object)
|
||||||
return a:file_object[1]
|
return a:file_object[1]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" XXX überlegen, ob man das scp vorne dranpackt
|
|
||||||
function! vimwiki#path#to_string(path)
|
" Returns: the dir_obj or file_obj as string, ready to be used with the regular
|
||||||
let dir_obj = type(a:path) == 4 ? a:path : a:path[0]
|
" path handling functions in Vim
|
||||||
|
function! vimwiki#path#to_string(obj)
|
||||||
|
let dir_obj = type(a:obj) == 4 ? a:obj : a:obj[0]
|
||||||
let separator = dir_obj.is_unix ? '/' : '\'
|
let separator = dir_obj.is_unix ? '/' : '\'
|
||||||
let address = join(dir_obj.path, separator) . separator
|
let address = join(dir_obj.path, separator) . separator
|
||||||
if type(a:path) == 3
|
if type(a:obj) == 3
|
||||||
let address .= a:path[1]
|
let address .= a:path[1]
|
||||||
endif
|
endif
|
||||||
return address
|
return address
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Returns: the given a:dir_obj with a:str appended to the dir name
|
||||||
|
function! vimwiki#path#append_to_dirname(dir_obj, str)
|
||||||
|
let a:dir_obj.path[-1] .= a:str
|
||||||
|
return a:dir_obj
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Assume it is not an absolute path
|
" Assume it is not an absolute path
|
||||||
function! vimwiki#path#from_segment_file(path_segment)
|
function! vimwiki#path#from_segment_file(path_segment)
|
||||||
let filename = fnamemodify(a:path_segment, ':t')
|
let filename = fnamemodify(a:path_segment, ':t')
|
||||||
let path = fnamemodify(a:filepath, ':h')
|
let path = fnamemodify(a:path_segment, ':h')
|
||||||
let path_list = (path ==# '.' ? [] : split(path, '\m[/\\]', 1))
|
let path_list = (path ==# '.' ? [] : split(path, '\m[/\\]', 1))
|
||||||
return [path_list, filename]
|
return [path_list, filename]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Assume it is not an absolute path
|
||||||
|
function! vimwiki#path#from_segment_dir(path_segment)
|
||||||
|
return split(a:path_segment, '\m[/\\]', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! vimwiki#path#join(dir_path, file_segment)
|
function! vimwiki#path#join(dir_path, file_segment)
|
||||||
let new_dir_object = copy(a:dir_path)
|
let new_dir_object = copy(a:dir_path)
|
||||||
@ -252,17 +270,13 @@ function! vimwiki#path#join(dir_path, file_segment)
|
|||||||
return [new_dir_object, a:file_segment[1]]
|
return [new_dir_object, a:file_segment[1]]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vimwiki#path#join_dir(dir_path, dir_segment)
|
||||||
function! vimwiki#path#exists(object)
|
let new_dir_object = copy(a:dir_path)
|
||||||
if type(a:object) == 4
|
let new_dir_object.path += a:dir_segment
|
||||||
return isdirectory(vimwiki#path#to_string(a:object))
|
return new_dir_object
|
||||||
else
|
|
||||||
" glob() checks whether or not a file exists (readable, writable or not)
|
|
||||||
return glob(vimwiki#path#to_string(a:file_object)) != ''
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" returns the segment s, so that jon(dir, s) == file
|
" returns the segment s, so that join(dir, s) == file
|
||||||
" we just assume the file is somewhere in dir
|
" we just assume the file is somewhere in dir
|
||||||
function! vimwiki#path#subtract(dir_object, file_object)
|
function! vimwiki#path#subtract(dir_object, file_object)
|
||||||
let path_rest = a:file_object[0].path[len(a:dir_object.path):]
|
let path_rest = a:file_object[0].path[len(a:dir_object.path):]
|
||||||
@ -292,11 +306,31 @@ function! vimwiki#path#relpath(dir1_object, dir2_object)
|
|||||||
return result
|
return result
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
"-----------------
|
||||||
|
" File manipulation, i.e. do stuff with actually existing files
|
||||||
|
"-----------------
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#path#current_file()
|
||||||
|
return vimwiki#path#file_obj(expand('%:p'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! vimwiki#path#exists(object)
|
||||||
|
if type(a:object) == 4
|
||||||
|
return isdirectory(vimwiki#path#to_string(a:object))
|
||||||
|
else
|
||||||
|
" glob() checks whether or not a file exists (readable or writable)
|
||||||
|
return glob(vimwiki#path#to_string(a:object)) != ''
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" this must be outside a function, because only outside a function <sfile> expands
|
" this must be outside a function, because only outside a function <sfile> expands
|
||||||
" to the directory where this file is in
|
" to the directory where this file is in
|
||||||
let s:vimwiki_autoload_dir = expand('<sfile>:p:h')
|
let s:vimwiki_autoload_dir = expand('<sfile>:p:h')
|
||||||
|
|
||||||
function! vimwiki#path#find_autoload_file(filename)
|
function! vimwiki#path#find_autoload_file(filename)
|
||||||
let autoload_dir = vimwiki#path#from_absolute_dir(s:vimwiki_autoload_dir)
|
let autoload_dir = vimwiki#path#dir_obj(s:vimwiki_autoload_dir)
|
||||||
let filename_obj = vimwiki#path#from_segment_file(a:filename)
|
let filename_obj = vimwiki#path#from_segment_file(a:filename)
|
||||||
let file = vimwiki#path#join(autoload_dir, filename_obj)
|
let file = vimwiki#path#join(autoload_dir, filename_obj)
|
||||||
if !vimwiki#path#exists(file)
|
if !vimwiki#path#exists(file)
|
||||||
|
@ -152,19 +152,8 @@ function! s:populate_global_variables()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:normalize_path(path) "{{{
|
" g:vimwiki_wikilocal_vars is a list of dictionaries: one dict for every registered wiki plus one
|
||||||
" trim trailing / and \ because otherwise resolve() doesn't work quite right
|
" (the last in the list) which contains the default values (used for temporary wikis).
|
||||||
let path = substitute(a:path, '[/\\]\+$', '', '')
|
|
||||||
if path !~# '^scp:'
|
|
||||||
return resolve(expand(path)).'/'
|
|
||||||
else
|
|
||||||
return path.'/'
|
|
||||||
endif
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
|
|
||||||
" g:vimwiki_wikilocal_vars is a list of dictionaries. One dict for every registered wiki. The last
|
|
||||||
" dictionary contains default values (used for temporary wikis)
|
|
||||||
function! s:populate_wikilocal_options()
|
function! s:populate_wikilocal_options()
|
||||||
let default_values = {
|
let default_values = {
|
||||||
\ 'auto_export': 0,
|
\ 'auto_export': 0,
|
||||||
@ -230,18 +219,19 @@ endfunction
|
|||||||
|
|
||||||
function! s:validate_settings()
|
function! s:validate_settings()
|
||||||
for wiki_settings in g:vimwiki_wikilocal_vars
|
for wiki_settings in g:vimwiki_wikilocal_vars
|
||||||
let wiki_settings['path'] = s:normalize_path(wiki_settings['path'])
|
let wiki_settings['path'] = vimwiki#path#dir_obj(wiki_settings['path'])
|
||||||
|
|
||||||
let path_html = wiki_settings['path_html']
|
let path_html = wiki_settings['path_html']
|
||||||
if !empty(path_html)
|
if !empty(path_html)
|
||||||
let wiki_settings['path_html'] = s:normalize_path(path_html)
|
let wiki_settings['path_html'] = vimwiki#path#dir_obj(path_html)
|
||||||
else
|
else
|
||||||
let wiki_settings['path_html'] = s:normalize_path(
|
let wiki_settings['path_html'] = vimwiki#path#append_to_dirname(wiki_settings['path'],
|
||||||
\ substitute(wiki_settings['path'], '[/\\]\+$', '', '').'_html/')
|
\ '_html')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let wiki_settings['template_path'] = s:normalize_path(wiki_settings['template_path'])
|
let wiki_settings['template_path'] = vimwiki#path#dir_obj(wiki_settings['template_path'])
|
||||||
let wiki_settings['diary_rel_path'] = s:normalize_path(wiki_settings['diary_rel_path'])
|
let wiki_settings['diary_path'] = vimwiki#path#join_dir(wiki_settings['path'],
|
||||||
|
\ vimwiki#path#from_segment_dir(wiki_settings['diary_rel_path']))
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ endfunction "}}}
|
|||||||
" create a new temporary wiki for the current buffer
|
" create a new temporary wiki for the current buffer
|
||||||
function! s:create_temporary_wiki()
|
function! s:create_temporary_wiki()
|
||||||
let current_file = vimwiki#path#current_file()
|
let current_file = vimwiki#path#current_file()
|
||||||
let path = vimwiki#path#directory(current_file)
|
let path = vimwiki#path#directory_of_file(current_file)
|
||||||
let ext = '.'.vimwiki#path#extension(current_file)
|
let ext = '.'.vimwiki#path#extension(current_file)
|
||||||
|
|
||||||
let syntax_mapping = vimwiki#vars#get_global('ext2syntax')
|
let syntax_mapping = vimwiki#vars#get_global('ext2syntax')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user