Changes

Jump to: navigation, search

Module:Message box

124 bytes added, 17:04, 26 January 2014
fix bug for data being shared between multiple message boxes called from the same module; allow boxes to be hidden; use Module:Arguments to fetch the arguments
-- Require necessary modules.
local getArgs = require('Module:Arguments').getArgs
local htmlBuilder = require('Module:HtmlBuilder')
local categoryHandler = require('Module:Category handler').main
local trim = mw.text.trim
local box = {}---------------------------------------------------------------------------------- Helper functions--------------------------------------------------------------------------------
local function getTitleObject(page, ...)
table.sort(nums)
return nums
end
 
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
 
local box = {}
box.__index = box
 
function box.new()
local obj = {}
setmetatable(obj, box)
return obj
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
if yesno(args.hidden) then
self:addClass('infobox editsection')
end
self:addClass(self.typeClass)
local function main(boxType, args)
local outputBox = box.new() outputBox:setTitle(args) local cfg = boxoutputBox:getConfig(boxType) args = boxoutputBox:removeBlankArgs(cfg, args) boxoutputBox:setBoxParameters(cfg, args) return boxoutputBox:export()
end
local function makeWrapper(boxType)
return function (frame)
-- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume local args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFramegetArgs() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs {trim = frame.args break end else origArgs = frame end -- Trim whitespace. local args false, removeBlanks = {false} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end
return main(boxType, args)
end
Anonymous user

Navigation menu