RogerDodger (talk | contribs) (split from module:patch to remove race condition) Â |
RogerDodger (talk | contribs) No edit summary  |
||
Line 11: | Line 11: | ||
local ret = "" | local ret = "" | ||
for _, obj in ipairs(versions) do | for _, obj in ipairs(versions) do | ||
local version, date = obj[1], obj[2] | if obj[3] == true then | ||
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 } | |||
} | } | ||
ret = ret .. h2 .. "\n\n" .. hat .. "\n" .. notes | 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 | end | ||
end | end |
Latest revision as of 01:12, 30 June 2022
Documentation for this module may be created at Module:Changelog/doc
local p = {}
local versions = require("Module:Patch").versions
p.main = function(frame)
local char = frame.args[1]
return p._main(char)
end
p._main = function(char)
local frame = mw.getCurrentFrame()
local ret = ""
for _, obj in ipairs(versions) do
if obj[3] == true then
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
end
return ret
end
return p