5,478
edits
mNo edit summary |
No edit summary |
||
Line 61: | Line 61: | ||
orderBy = "Album_Songs.song_page ASC, Album_Songs.album ASC" | orderBy = "Album_Songs.song_page ASC, Album_Songs.album ASC" | ||
} | } | ||
local fields = { 'song_page', 'album', 'type', 'singers' } | local fields = { 'song_page', 'song_title', 'album', 'type', 'singers' } | ||
local results = cargo.query('Album_Songs', table.concat(fields, ','), query) | local results = cargo.query('Album_Songs', table.concat(fields, ','), query) | ||
local groups = {} | local groups = {} | ||
local pageNames = {} | |||
for _, result in ipairs(results) do | for _, result in ipairs(results) do | ||
local singers = mw.text.split(result.singers, ",") | local singers = mw.text.split(result.singers, ",") | ||
Line 82: | Line 83: | ||
if type ~= nil then | if type ~= nil then | ||
if not groups[result. | if not groups[result.song_title] then groups[result.song_title] = {} end | ||
table.insert(groups[result. | pageNames[result.song_title] = result.song_page | ||
table.insert(groups[result.song_title], { album = result.album, type = type }) | |||
end | end | ||
end | end | ||
Line 92: | Line 94: | ||
local head = table.remove(rows, 1) | local head = table.remove(rows, 1) | ||
text = text .. | text = text .. | ||
string.format('|-\n| rowspan=%d|[[%s]] || [[%s]] || %s\n', rowspan, song, head.album, head.type) | string.format('|-\n| rowspan=%d|[[%s|%s]] || [[%s]] || %s\n', rowspan, song, pageNames[song], head.album, head.type) | ||
for _, row in ipairs(rows) do | for _, row in ipairs(rows) do | ||
text = text .. | text = text .. |