Module:Infobox: Difference between revisions
no edit summary
OtherXAdmin (talk | contribs) No edit summary Tags: Manual revert Reverted |
OtherXAdmin (talk | contribs) No edit summary Tag: Reverted |
||
Line 13: | Line 13: | ||
return string.match(arg or '','%S') and arg or default | return string.match(arg or '','%S') and arg or default | ||
end | end | ||
function Infobox.new(args) | |||
local self = setmetatable({}, Infobox) | |||
self.args = args | |||
-- Initialize other properties as needed | |||
return self | |||
end | |||
-- defineParams method to set the parameters | |||
function Infobox.defineParams(self, params) | |||
self.params = params | |||
end | |||
-- addRow method to add rows to the infobox | |||
function Infobox.addRow(self, row) | |||
if not self.rows then | |||
self.rows = {} | |||
end | |||
table.insert(self.rows, row) | |||
end | |||
-- cleanParams method to clean up the parameters | |||
function Infobox.cleanParams(self) | |||
if self.params then | |||
for _, param in ipairs(self.params) do | |||
if self.args[param] then | |||
self.args[param] = self:cleanParam(self.args[param]) | |||
end | |||
end | |||
end | |||
end | |||
-- cleanParam method to clean individual parameters | |||
function Infobox.cleanParam(self, param) | |||
-- You can add custom cleaning logic for each parameter here | |||
-- For example, trimming whitespace, formatting dates, etc. | |||
return param | |||
end | |||
-- Standardised "release" function | -- Standardised "release" function |