Differenze tra le versioni di "Modulo:AIRBox"

Da Wiki Acquisti in rete PA.
m
m
Riga 19: Riga 19:


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


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

Versione delle 16:24, 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 boxHeader = mw.html.create('div')
    boxHeader:addClass('box-header')
    boxHeader:wikitext(frame:preprocess(titolo))

    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
            iconDiv:addClass('remember')
        elseif icona == "warning" then
            iconDiv:addClass('warning')
        end
	output:node(iconDiv)
        
    end

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

    contentDiv:node(boxHeader)

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

    
    output:node(contentDiv)

    return tostring(output)
end

return p