Differenze tra le versioni di "Modulo:AIRBox"

Da Wiki Acquisti in rete PA.
m
m
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 ""


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


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


     local boxHeader = mw.html.create('div')
if icona == "remember" then
     boxHeader:addClass('box-header')
     iconDiv:addClass('remember')
    boxHeader:wikitext(frame:preprocess(titolo))
elseif icona == "warning" then
     iconDiv:addClass('warning')
end


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


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


    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 delle 15:40, 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')

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

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

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

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

return tostring(output)
end

return p