Differenze tra le versioni di "Modulo:AIRBox"

Da Wiki Acquisti in rete PA.
m
m
Riga 32: Riga 32:
contentColumnDiv:addClass('box-content-column')
contentColumnDiv:addClass('box-content-column')
output:node(contentColumnDiv)
output:node(contentColumnDiv)
if titolo and titolo ~= "" then


local boxHeader = mw.html.create('div')
local boxHeader = mw.html.create('div')
Riga 37: Riga 39:
boxHeader:wikitext(frame:preprocess(titolo))
boxHeader:wikitext(frame:preprocess(titolo))
contentColumnDiv:node(boxHeader)
contentColumnDiv:node(boxHeader)
end


local boxBody = mw.html.create('div')
local boxBody = mw.html.create('div')

Versione delle 17:06, 29 mag 2023

La documentazione per questo modulo può essere creata in Modulo:AIRBox/man

-- Nome del modulo: AIRBox

local p = {}

function p.renderBox(frame)
    local args = frame.args

local titolo = args.titolo or "Da sapere che"
local testo = args.testo or ""
local icona = args.icona or ""

local output = mw.html.create('div')
output:addClass('multibox')

if icona and icona ~= "" then
local imgColumnDiv = mw.html.create('div')
imgColumnDiv:addClass('box-img-column')
output:node(imgColumnDiv)

local iconDiv = mw.html.create('div')
iconDiv:addClass('box-icon')
imgColumnDiv:node(iconDiv)

if icona == "remember" then
    iconDiv:addClass('remember')
elseif icona == "warning" then
    iconDiv:addClass('warning')
end
end 

local contentColumnDiv = mw.html.create('div')
contentColumnDiv:addClass('box-content-column')
output:node(contentColumnDiv)

if titolo and titolo ~= "" then

local boxHeader = mw.html.create('div')
boxHeader:addClass('box-header')
boxHeader:wikitext(frame:preprocess(titolo))
contentColumnDiv:node(boxHeader)

end

local boxBody = mw.html.create('div')
boxBody:addClass('box-body')
boxBody:wikitext(frame:preprocess(testo))
contentColumnDiv:node(boxBody)

return tostring(output)
end

return p