Module

Module:Contributors

Documentation for this module may be created at Module:Contributors/doc

local p = {}
local cargo = mw.ext.cargo

function p.Main( frame )
    local tables = 'Contributors'
    local fields = 'CONCAT ( SUBSTRING_INDEX(Name, ",", -1), " ", SUBSTRING_INDEX(Name, ",", 1) )=Contributor, Place=About, _pageName=Page, Contribution'
    local args = {
    	orderBy = 'Name',
    	limit = '200'
    }
    local results = cargo.query( tables, fields, args )
    local output = ''
    local oldcontributor = ''
    for r = 1, #results do
        local result = results[r]
        local contributor = result['Contributor']
        local about = result['About']
        local page = result['Page']
        local contribution = result['Contribution']

		if ( ( contributor ~= oldcontributor ) or ( contributor == ' Anonymous' ) ) then
			output = output .. '\n<b>' .. contributor .. '</b> (' .. about .. ')'
		end
        oldcontributor = contributor
        
        output = output .. "\n*[[" .. page .. "]] — " .. contribution
    end
    return output
end

return p