Content deleted Content added
move the action parameter values to the config |
split action object creation into its own method |
||
Line 9:
local CONFIG_PAGE = 'Module:Article history/config'
local WRAPPER_TEMPLATE = 'Template:Article history'
-------------------------------------------------------------------------------
Line 53 ⟶ 54:
-------------------------------------------------------------------------------
--
--
-- collapsed section. They usually have an image and a blurb.
-------------------------------------------------------------------------------
local
-------------------------------------------------------------------------------
Line 107 ⟶ 109:
obj.categories = {}
return obj▼
-- Initialise the action objects▼
-- Filter the arguments for actions.▼
function ArticleHistory:initializeActionObjects()
local actionParams = {}▼
local pattern = '^' .. obj.cfg.actionParamPrefix .. '([1-9][0-9]*)(.-)$'▼
local suffixes = obj.cfg.actionParamSuffixes▼
for k, v in pairs(args) do▼
local t = actionParams[num] or {}▼
num = tonumber(num)
▲ t[suffixes[suffix]] = v
end
▲ end
-- Sort the action parameters.▼
local actionParamsSorted = {}▼
for num, t in pairs(actionParams) do▼
table.insert(actionParamsSorted, t)▼
end▼
table.sort(actionParamsSorted, function (t1, t2)▼
return t1.num < t2.num▼
end)▼
for _, t in ipairs(actionParamsSorted) do▼
table.insert(obj.actions, Action.new(t))▼
end
end
▲ return obj
t.articleHistoryObj = self
end
end
Line 191:
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers =
})
return p._main(args)
|