Moduł:Topki

Z Nonsensopedii, polskiej encyklopedii humoru

Skocz do: nawigacji, szukaj
local p = {}
p.snames = {
    g = {name = "Google", site = "www.google.pl/search?q="},
    b = {name = "Bing", site = "www.bing.com/search?q="},
    d = {name = "DuckDuckGo", site = "duckduckgo.com/?q="},
}
p.pokaz = function(f)
    if f.args[1] == nil then
        mw.log("Nie zdefiniowano 1. parametru!")
        return ""
    end
    local gt = {"# [[" .. f.args[1] .. "]]"}
    for k,v in pairs(p.snames) do
        if f.args[k] == nil then
            mw.log(k .. " is nil!")
        else
            local st = {}
            for s in mw.text.gsplit(f.args[k], ",") do
                local ts = mw.text.trim(s)
                table.insert(st, "[https://" .. v.site .. mw.uri.encode(ts, "QUERY") .. " " .. ts .. "]")
            end
            table.insert(gt, v.name .. ": " .. mw.text.listToText(st))
        end
    end
    return table.concat(gt, "\n#:")
end
 
return p
Nasze strony
Przyjaciele