Differenze tra le versioni di "Modulo:AIRBox"

Da Wiki Acquisti in rete PA.
m
m
Riga 13: Riga 13:
     output:addClass('multibox')
     output:addClass('multibox')


     if titolo ~= "ciaone" then
     local boxHeader = mw.html.create('div')
        local header = mw.html.create('div')
    boxHeader:addClass('box-header')
        header:addClass('box-header')


        if icona ~= "" then
    if icona ~= "" then
            local icon = mw.html.create('div')
        local iconImg = mw.html.create('img')
            icon:addClass('box-icon')
        iconImg:addClass('box-icon')
            icon:wikitext(icona)
        iconImg:attr('src', icona)
            header:node(icon)
         boxHeader:node(iconImg)
        end
 
        header:wikitext(titolo)
         output:node(header)
     end
     end


     local body = mw.html.create('div')
     boxHeader:wikitext(titolo)
     body:addClass('box-body')
     output:node(boxHeader)


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


     return tostring(output)
     return tostring(output)

Versione delle 11:07, 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')

    if icona ~= "" then
        local iconImg = mw.html.create('img')
        iconImg:addClass('box-icon')
        iconImg:attr('src', icona)
        boxHeader:node(iconImg)
    end

    boxHeader:wikitext(titolo)
    output:node(boxHeader)

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

    return tostring(output)
end

return p