Aller au contenu

Module:For

De Wiki Undertale FR

Error: Missing Lua documentation! Check other modules to see examples how to write Lua module documentation.

-- <nowiki>
local p = {}

local title = mw.title.getCurrentTitle()

function main(thing, link, link2)
    thing = type(thing) == 'string' and thing or 'other uses'
    link = type(link) == 'string' and
        link or
        title.text .. ' (disambiguation)'
    if type(link2) == 'string' and link2 ~= '' then
        return 'Pour ' .. thing .. ', voir [[' .. link .. ']] ou [[' .. link2 .. ']].'
    else
        return 'Pour ' .. thing .. ', voir [[' .. link .. ']].'
    end
end

function dd(html, text)
    html:tag('div')
            :attr('role', 'note')
            :addClass('hatnote')
            :addClass('navigation-not-searchable')
            :wikitext(text)
        :done()
    :done()
end

function p.main(frame)
    local args = frame:getParent().args
    local temp = {}
    local curr = false
    local html = mw.html.create('div')
    for k, v in ipairs(args) do
        local rest = tonumber(k) % 3
        if rest == 0 then
            dd(html, main(temp[1], temp[2], v))
            curr = false
        else
            temp[rest] = v
            curr = true
        end
    end
    if curr then
        dd(html, main(temp[1], temp[2]))
    end
    return tostring(html:done())
end

return p
-- </nowiki>