Module:Sequences/Supported Sequences

local p = {}

local Franchise = require("Module:Franchise") local utilsCargo = require("Module:UtilsCargo") local utilsLayout = require("Module:UtilsLayout") local utilsMarkup = require("Module:UtilsMarkup") local utilsTable = require("Module:UtilsTable")

function p.Main(frame) local queryResults = utilsCargo.query("Sequences", "_pageName, game, sequence, subject", {		sortBy = "ordinality",		limit= 5000	}) local sequences = utilsTable.groupBy(queryResults, "game") sequences = utilsTable.mapValues(sequences, utilsTable._groupBy("sequence")) local headers = {"Sequence", "Stored At", "Subjects"} local tabs = {} for i, gameCode in ipairs(Franchise.enum) do		local gameSequences = sequences[gameCode] or {} local tabRows = {} for sequence, subjects in pairs(gameSequences) do			local subjectNames = utilsTable.map(subjects, "subject") local subjectLinks = utilsTable.map(subjectNames, function(page) return utilsMarkup.link(page, page, true) end) subjectLinks = table.concat(subjectLinks, " • ") subjectLinks = mw.html.create("div") :wikitext(subjectLinks) :css({					["max-width"] = "30rem",					["white-space"] = "nowrap",					["overflow"] = "hidden",					["text-overflow"] = "ellipsis",				}) table.insert(tabRows, {				" ",				utilsMarkup.link(subjects[1]._pageName),				tostring(subjectLinks),			}) end tabRows = utilsTable.sortBy(tabRows, 1) if #tabRows > 0 then table.insert(tabs, {				label = gameCode,				rows = tabRows,			}) end end local wikitable = utilsLayout.tabbedTable({		headerRows = {headers},		tabs = tabs,	}) return wikitable end

return p