fixed name of new files

This commit is contained in:
2026-05-26 09:30:35 +02:00
parent 270be048dc
commit aea1b5322d
+5 -6
View File
@@ -10,8 +10,7 @@
"
" This function removes illegal characters in parts of the filename.
function s:santizefnpart(part)
return a:part->tolower()
\ ->substitute('[^[:alnum:]]', '-', 'g')
return a:part->substitute('[^[:alnum:]]', '-', 'g')
\ ->substitute('-\+', '-', 'g')
\ ->substitute('_\+', '_', 'g')
\ ->substitute('=\+', '=', 'g')
@@ -40,10 +39,10 @@ endfunction
" @argument a:sig string: Signature string of denote entry
function libdenote#scheme_filename(ext, identifier, title='', tags=[], sig='')
let l:f = s:santizefnpart(a:identifier)
let l:f ..= len(a:sig) > 0 ? ('==' .. s:santizefnpart(a:sig)) : ''
let l:f ..= len(a:title) > 0 ? ('--' .. s:santizefnpart(a:title)) : ''
let l:f ..= len(a:tags) > 0 ? ('__' .. map(copy(a:tags), {_, v -> s:santizefnpart(v)})->join('_')) : ''
return l:f .. '.' .. a:ext
let l:f ..= len(a:sig) > 0 ? ('==' .. s:santizefnpart(a:sig))->tolower() : ''
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('_'))->tolower() : ''
return l:f .. '.' .. a:ext->tolower()
endfunction
" Retrieve metadata from file name