Implemented a shorttitle substitution for templates, when creating notes in subdirs the shorttitle only uses that last part of the filename, not the entire path

This commit is contained in:
Alexander Lay-Calvert
2022-09-23 14:16:08 -04:00
parent fdb089daf6
commit 1d30d5c432

View File

@@ -613,6 +613,11 @@ local function linesubst(line, title, dates, uuid)
uuid = "" uuid = ""
end end
shorttitle = string.match(title, '^.+/(.+)$')
if shorttitle == nil then
shorttitle = title
end
local substs = { local substs = {
hdate = dates.hdate, hdate = dates.hdate,
week = dates.week, week = dates.week,
@@ -637,6 +642,7 @@ local function linesubst(line, title, dates, uuid)
saturday = dates.saturday, saturday = dates.saturday,
title = title, title = title,
shorttitle = shorttitle,
uuid = uuid, uuid = uuid,
} }
for k, v in pairs(substs) do for k, v in pairs(substs) do