Support for absolute links when converting to HTML

Also, Fix #124
This commit is contained in:
EinfachToll
2015-04-09 14:48:26 +02:00
parent 62da755350
commit 99494655c2
4 changed files with 101 additions and 184 deletions

View File

@ -92,13 +92,20 @@ function! vimwiki#path#relpath(dir, file) "{{{
call remove(dir, 0)
call remove(file, 0)
endwhile
if empty(dir) && empty(file)
return './'
endif
for segment in dir
let result += ['..']
endfor
for segment in file
let result += [segment]
endfor
return join(result, '/')
let result_path = join(result, '/')
if a:file =~ '\m/$'
let result_path .= '/'
endif
return result_path
endfunction "}}}
" If the optional argument provided and nonzero,
@ -133,3 +140,11 @@ function! vimwiki#path#mkdir(path, ...) "{{{
return 1
endif
endfunction " }}}
function! vimwiki#path#is_absolute(path) "{{{
if vimwiki#u#is_windows()
return a:path =~? '\m^\a:'
else
return a:path =~# '\m^/\|\~/'
endif
endfunction "}}}