fixed name of new files

This commit is contained in:
2026-05-26 09:30:35 +02:00
parent 270be048dc
commit aea1b5322d
+10 -11
View File
@@ -10,13 +10,12 @@
" "
" 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') \ ->substitute('@\+', '@', 'g')
\ ->substitute('@\+', '@', 'g') \ ->trim('-_@=')
\ ->trim('-_@=')
endfunction endfunction
" API {{{2 " API {{{2
@@ -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