fixed name of new files
This commit is contained in:
@@ -10,8 +10,7 @@
|
|||||||
"
|
"
|
||||||
" This function removes illegal characters in parts of the filename.
|
" This function removes illegal characters in parts of the filename.
|
||||||
function s:santizefnpart(part)
|
function s:santizefnpart(part)
|
||||||
return a:part->tolower()
|
return a:part->substitute('[^[:alnum:]]', '-', 'g')
|
||||||
\ ->substitute('[^[:alnum:]]', '-', 'g')
|
|
||||||
\ ->substitute('-\+', '-', 'g')
|
\ ->substitute('-\+', '-', 'g')
|
||||||
\ ->substitute('_\+', '_', 'g')
|
\ ->substitute('_\+', '_', 'g')
|
||||||
\ ->substitute('=\+', '=', 'g')
|
\ ->substitute('=\+', '=', 'g')
|
||||||
@@ -40,10 +39,10 @@ endfunction
|
|||||||
" @argument a:sig string: Signature string of denote entry
|
" @argument a:sig string: Signature string of denote entry
|
||||||
function libdenote#scheme_filename(ext, identifier, title='', tags=[], sig='')
|
function libdenote#scheme_filename(ext, identifier, title='', tags=[], sig='')
|
||||||
let l:f = s:santizefnpart(a:identifier)
|
let l:f = s:santizefnpart(a:identifier)
|
||||||
let l:f ..= len(a:sig) > 0 ? ('==' .. s:santizefnpart(a:sig)) : ''
|
let l:f ..= len(a:sig) > 0 ? ('==' .. s:santizefnpart(a:sig))->tolower() : ''
|
||||||
let l:f ..= len(a:title) > 0 ? ('--' .. s:santizefnpart(a:title)) : ''
|
let l:f ..= len(a:title) > 0 ? ('--' .. s:santizefnpart(a:title))->tolower() : ''
|
||||||
let l:f ..= len(a:tags) > 0 ? ('__' .. map(copy(a:tags), {_, v -> s:santizefnpart(v)})->join('_')) : ''
|
let l:f ..= len(a:tags) > 0 ? ('__' .. map(copy(a:tags), {_, v -> s:santizefnpart(v)})->join('_'))->tolower() : ''
|
||||||
return l:f .. '.' .. a:ext
|
return l:f .. '.' .. a:ext->tolower()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Retrieve metadata from file name
|
" Retrieve metadata from file name
|
||||||
|
|||||||
Reference in New Issue
Block a user