RogerDodger (talk | contribs) No edit summary |
mNo edit summary |
||
Line 7: | Line 7: | ||
{ "4.01", "26 Nov 2020" }, | { "4.01", "26 Nov 2020" }, | ||
{ "4.00", "10 Nov 2020" }, | { "4.00", "10 Nov 2020" }, | ||
{ "3.33", "19 Aug 2020" }, | |||
} | } | ||
Revision as of 18:16, 16 July 2021
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" },
{ "3.33", "19 Aug 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 globalNotes = frame:callParserFunction{
name = '#lsth',
args = { page, "General changes" }
}
if globalNotes ~= "" then
notes = notes .. globalNotes .. "\n"
end
local charNotes = frame:callParserFunction{
name = '#lsth',
args = { page, char }
}
if charNotes ~= "" then
notes = notes .. charNotes .. "\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