Differenze tra le versioni di "Modulo:AIRBox"

Da Wiki Acquisti in rete PA.
m
m
 
(12 versioni intermedie di uno stesso utente non sono mostrate)
Riga 6: Riga 6:
     local args = frame.args
     local args = frame.args


    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
    local imgColumnDiv = mw.html.create('div')
    imgColumnDiv:addClass('box-img-column')
        local iconDiv = mw.html.create('div')
        iconDiv:addClass('box-icon')


        if icona == "remember" then
if icona and icona ~= "" and icona ~= "noico" then
            iconDiv:addClass('remember')
local imgColumnDiv = mw.html.create('div')
        elseif icona == "warning" then
imgColumnDiv:addClass('box-img-column')
            iconDiv:addClass('warning')
output:node(imgColumnDiv)
        end
 
       
local iconDiv = mw.html.create('div')
        output:node(imgColumnDiv)
iconDiv:addClass('box-icon')
iconDiv:node(imgColumnDiv)
imgColumnDiv:node(iconDiv)
     end
 
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')
      
      
    local contentColumnDiv = mw.html.create('div')
end
    contentColumnDiv:addClass('box-content-column')
end


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


    local boxHeader = mw.html.create('div')
if titolo and titolo ~= "" and titolo ~= "notitle" then
    boxHeader:addClass('box-header')
    boxHeader:wikitext(frame:preprocess(titolo))


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


end


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


    return tostring(output)
return tostring(output)
end
end


return p
return p

Versione attuale delle 11: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