Always return a uuid from get_uuid

We were previously only returning a uuid if the user wanted to include
them in their filenames, which meant that they couldn't be included in
the template itself.
This commit is contained in:
Ernie Miller
2022-05-12 07:32:03 -04:00
parent 17542ee617
commit 952141e78e

View File

@@ -191,24 +191,20 @@ local function random_variable(length)
end end
local function get_uuid(opts) local function get_uuid(opts)
opts.prefix_title_by_uuid = opts.prefix_title_by_uuid
or M.Cfg.prefix_title_by_uuid
opts.uuid_type = opts.uuid_type or M.Cfg.uuid_type opts.uuid_type = opts.uuid_type or M.Cfg.uuid_type
local uuid local uuid
if opts.prefix_title_by_uuid then
if opts.uuid_type ~= "rand" then if opts.uuid_type ~= "rand" then
uuid = os.date(opts.uuid_type) uuid = os.date(opts.uuid_type)
else else
uuid = random_variable(6) uuid = random_variable(6)
end end
end
return uuid return uuid
end end
local function concat_uuid_title(uuid, title) local function concat_uuid_title(uuid, title)
local sep = M.Cfg.uuid_sep or "-" local sep = M.Cfg.uuid_sep or "-"
if uuid == nil then if uuid == nil or not M.Cfg.prefix_title_by_uuid then
return title return title
else else
return uuid .. sep .. title return uuid .. sep .. title