Differenze tra le versioni di "Modulo:AIRBox"

Da Wiki Acquisti in rete PA.
m
m
 
(16 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')
   


    local boxHeader = mw.html.create('div')
if icona and icona ~= "" and icona ~= "noico" then
    boxHeader:addClass('box-header')
local imgColumnDiv = mw.html.create('div')
    boxHeader:wikitext(frame:preprocess(titolo))
imgColumnDiv:addClass('box-img-column')
output:node(imgColumnDiv)


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


        if icona == "remember" then
if icona == "ricorda" then
            iconDiv:addClass('remember')
    iconDiv:addClass('ricorda')
        elseif icona == "warning" then
elseif icona == "idea" then
            iconDiv:addClass('warning')
    iconDiv:addClass('idea')
        end
elseif icona == "normativa" then
        output:node(imgColumnDiv)
    iconDiv:addClass('normativa')
output:node(iconDiv)
elseif icona == "tool" then
     end
    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')
local contentColumnDiv = mw.html.create('div')
    contentColumnDiv:addClass('box-content-column')
contentColumnDiv:addClass('box-content-column')
   
output:node(contentColumnDiv)
    local contentDiv = mw.html.create('div')
 
    contentDiv:addClass('box-content')
if titolo and titolo ~= "" and titolo ~= "notitle" then


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


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


   
local boxBody = mw.html.create('div')
    output:node(contentColumnDiv)
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