You can provide last-modified
keyword (which refers to the last modified date and time of the file containing the date) to date and use date-format
to modify the date. Also you can put additional words in between square brackets which will be then escaped and kept as is.
---
title: "Some pdf document"
author: "me"
date: last-modified
date-format: "[Last Updated on] MMMM, YYYY"
format: pdf
---
Now, since there is no format-string for season name, it is possible make one using Pandoc Lua filter.
---
title: "Some pdf document"
author: "None"
date: last-modified
date-format: "[Last Updated on] %MMM%, YYYY"
format: pdf
filters:
- custom-date.lua
---
Note Here we have used %MMM%
, which will be replaced by season name.
custom-date.lua
local function replace_mon_with_season(date)
local season_table = {
Jan = "Winter", Feb = "Winter", Mar = "Spring",
Apr = "Spring", May = "Spring", Jun = "Summer",
Jul = "Summer", Aug = "Summer", Sep = "Autumn",
Oct = "Autumn", Nov = "Autumn", Dec = "Spring"
}
local date = pandoc.utils.stringify(date)
local mon = date:match("%%(%a+)%%")
local season = season_table[mon]
return date:gsub("%%" .. mon .. "%%", season)
end
function Meta(m)
m.date = replace_mon_with_season(m.date)
return m
end