Module:ListPeople
Appearance
Documentation for this module may be created at Module:ListPeople/doc
local p = {}
local cargo = mw.ext.cargo
function p.get()
local peopleSet = {}
-- Fetch Composer values
local composerResults = cargo.query('Compositions', 'Composer', {
groupBy = 'Composer',
limit = 1000
})
-- Fetch Arranger values
local arrangerResults = cargo.query('Compositions', 'Arranger', {
groupBy = 'Arranger',
limit = 1000
})
local function addNames(resultTable)
for _, row in ipairs(resultTable) do
local fieldValue = row[1] or ''
for name in mw.text.gsplit(fieldValue, '[,;]') do
name = mw.text.trim(name)
if name ~= '' then
peopleSet[name] = true
end
end
end
end
addNames(composerResults)
addNames(arrangerResults)
-- Convert to sorted list
local peopleList = {}
for name, _ in pairs(peopleSet) do
table.insert(peopleList, name)
end
table.sort(peopleList)
-- Build output
local out = {}
for _, name in ipairs(peopleList) do
table.insert(out, '* [[' .. name .. ']]')
end
return table.concat(out, '\n')
end
return p