From 952141e78ead1a1e3bca07ba248256963d1c7623 Mon Sep 17 00:00:00 2001 From: Ernie Miller Date: Thu, 12 May 2022 07:32:03 -0400 Subject: [PATCH] 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. --- lua/telekasten.lua | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index f5f14f3..bf9eb1d 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -191,24 +191,20 @@ local function random_variable(length) end 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 local uuid - if opts.prefix_title_by_uuid then - if opts.uuid_type ~= "rand" then - uuid = os.date(opts.uuid_type) - else - uuid = random_variable(6) - end + if opts.uuid_type ~= "rand" then + uuid = os.date(opts.uuid_type) + else + uuid = random_variable(6) end return uuid end local function concat_uuid_title(uuid, title) 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 else return uuid .. sep .. title