Module:ImageVote

From Meta, a Wikimedia project coordination wiki
Module documentation
-- Please keep in sync with [[:commons:Module:ImageVote]]
local p = {}
 
function p.gallery(frame)
    local args, pargs = frame.args, ( frame:getParent() or {} ).args
    local ret = {}
    if not args.tl then
        args = pargs
    end
 
    for k, v in ipairs( args ) do
        local img = v:gsub('\n', '')
        table.insert(ret, img .. '|' .. frame:preprocess( args.tl:gsub('$file', img) ):gsub('\n', ' '))
    end
    return table.concat(ret, '\n')
end
 
return p