Modulo:SemanticScribuntoTest

Versione del 8 ago 2023 alle 22:42 di Wikiadmin (discussione | contributi) (create for testing)
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)

La documentazione per questo modulo può essere creata in Modulo:SemanticScribuntoTest/man

-- Module:SMW
local p = {}

-- set with direct return results
function p.info( frame )

    if not mw.smw then
        return "mw.smw module not found"
    end

    if frame.args[1] == nil then
        return "no parameter found"
    end

    local tooltip
    if frame.args[2] then
        tooltip = mw.smw.info( frame.args[1], frame.args[2] )
    else
        tooltip = mw.smw.info( frame.args[1] )
    end

    return tooltip
end
-- another example, info used inside another function
function p.inlineInfo( frame )

    local output = 'This is sample output'

    -- so some stuff

    output = output .. mw.smw.info( 'This is a warning', 'warning' )

    -- some more stuff

    return output
end

return p