Documentation for this module may be created at Module:Patch/doc
local p = {}
-- Only including recent versions until the notes are tidied up, still big WIP
local versions = {
{ "4.20", "27 May 2021" },
{ "4.10", "22 Mar 2021" },
{ "4.01", "26 Nov 2020" },
{ "4.00", "10 Nov 2020" },
}
p.log = function(frame)
local char = frame.args[1]
return p._log(char)
end
p._log = function(char)
local frame = mw.getCurrentFrame()
local ret = ""
for _, obj in ipairs(versions) do
local version, date = obj[1], obj[2]
local page = "Version " .. version
local notes = ""
local charNotes = frame:callParserFunction{
name = '#lsth',
args = { page, char }
}
if charNotes ~= "" then
notes = notes .. charNotes .. "\n"
end
local globalNotes = frame:callParserFunction{
name = '#lsth',
args = { page, "General changes" }
}
if globalNotes ~= "" then
notes = notes .. globalNotes .. "\n"
end
if notes ~= "" then
local h2 = "==" .. version .. ", " .. date .. "=="
local hat = frame:expandTemplate{
title = "Hatnote",
args = { "Main article: [[" .. page .. "]]" }
}
ret = ret .. h2 .. "\n\n" .. hat .. "\n" .. notes
end
end
return ret
end
p.date = function(frame)
local v = frame.args[1]
return p._date(v)
end
p._date = function(v)
for _, version in ipairs(versions) do
if version[1] == v then
return version[2]
end
end
return ""
end
return p