|
Tags: Manual revert Reverted |
Line 12: |
Line 12: |
| function hasContent(arg, default) | | function hasContent(arg, default) |
| return string.match(arg or '','%S') and arg or default | | return string.match(arg or '','%S') and arg or default |
| 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 | | end |
|
| |
|