Differenze tra le versioni di "Modulo:AIRBox"

Da Wiki Acquisti in rete PA.
m
m
 
(7 versioni intermedie di uno stesso utente non sono mostrate)
Riga 8: Riga 8:
local titolo = args.titolo or "Da sapere che"
local titolo = args.titolo or "Da sapere che"
local testo = args.testo or ""
local testo = args.testo or ""
local icona = args.icona or ""
local icona = args.icona or "info"


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


if icona and icona ~= "" then
if icona and icona ~= "" and icona ~= "noico" then
local imgColumnDiv = mw.html.create('div')
local imgColumnDiv = mw.html.create('div')
imgColumnDiv:addClass('box-img-column')
imgColumnDiv:addClass('box-img-column')
Riga 32: Riga 32:
elseif icona == "danger" then
elseif icona == "danger" then
     iconDiv:addClass('danger')
     iconDiv:addClass('danger')
elseif icona == "info" then
elseif icona == "info" then
     iconDiv:addClass('info')
     iconDiv:addClass('info')
elseif icona == "news" then
    iconDiv:addClass('news')
      
      
end
end
Riga 42: Riga 44:
output:node(contentColumnDiv)
output:node(contentColumnDiv)


if titolo and titolo ~= "" then
if titolo and titolo ~= "" and titolo ~= "notitle" then


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

Versione attuale delle 12:50, 22 dic 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 "info"

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

if icona and icona ~= "" and icona ~= "noico" 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 == "ricorda" then
    iconDiv:addClass('ricorda')
elseif icona == "idea" then
    iconDiv:addClass('idea')
elseif icona == "normativa" then
    iconDiv:addClass('normativa')
elseif icona == "tool" then
    iconDiv:addClass('tool')
elseif icona == "danger" then
    iconDiv:addClass('danger')
elseif icona == "info" then
    iconDiv:addClass('info')
elseif icona == "news" then
    iconDiv:addClass('news')
    
end
end 

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

if titolo and titolo ~= "" and titolo ~= "notitle" 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