Zum Inhalt springen

Modul:Protection banner: Unterschied zwischen den Versionen

add a p.renderBanner function
(add p.renderPadlock function)
(add a p.renderBanner function)
Zeile 1: Zeile 1:
-- This module implements {{pp-meta}} and its daughter templates such as
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
--------------------------------------------------------------------------------
-- Configuration
--------------------------------------------------------------------------------


local categories = {
local categories = {
Zeile 80: Zeile 84:
-- Main functions
-- Main functions
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Initialise necessary modules.
local mArguments = require('Module:Arguments')
local mMessageBox -- only needs to be loaded if we are outputting a banner, so lazily initialise


-- Define often-used functions as local variables.
-- Define often-used functions as local variables.
Zeile 233: Zeile 241:


function p.renderPadlock(data)
function p.renderPadlock(data)
--[[
-- Renders the padlock seen in the top-right-hand corner or protected pages,
-- Renders the padlock seen in the top-right-hand corner or protected pages,
-- using the data provided in the data table.
-- using the data provided in the data table.
--
-- Data fields:
-- data.right
-- data.image
-- data.iconLink
-- data.iconText
-- data.altText
--]]
local root = mw.html.create('div')
local root = mw.html.create('div')
root
root
Zeile 245: Zeile 262:
))
))
return tostring(root)
return tostring(root)
end
function p.renderBanner(data)
--[[
-- Renders the large protection banner placed at the top of articles,
-- using the data provided in the data table.
--
-- Data fields:
-- data.page
-- data.image
-- data.text
--]]
mMessageBox = require('Module:Message box')
local mbargs = { -- arguments for the message box module
page = data.page,
type = 'protection',
image = data.image,
text = data.text
}
return mMessageBox.main('mbox', mbargs)
end
end


return p
return p
Anonymer Benutzer