Module:ListSeries

-- currently broken because I was fucking around -- to fix, remove __NEXT from loliInfoCleaned and replace HOLDS with =

local p = {} require("Module:StrManip") require('Module:Card') local cargo = mw.ext.cargo --https://help.gamepedia.com/Extension:Cargo --https://www.mediawiki.org/wiki/Extension:Cargo

--cargo query by field function listBySeries(series) local qFields = "Name, Image, Type, SubType, Series, VA, Role" local qArgs = { where = 'Series HOLDS LIKE "' .. tostring(series) .. '"', orderBy = "Name", limit = 9000,

}   local lolis = cargo.query("loliInfoCleaned__NEXT",qFields, qArgs) --mw.logObject(lolis) local root = mw.html.create('div') :cssText('display:flex; flex-flow:row wrap; hyphens:Auto;')

for i,loli in ipairs(lolis) do       mw.logObject(loli) root:Card(loli) end

return root end

--main function function p.listSeries local args = mw.getCurrentFrame.args[1] local qFields = "Series" local qArgs = { orderBy = "Series", limit = 9000, -- ENTRY NUMBER 97 CAUSES A FUCKING UNENCLOSED STRING LITERAL ERROR -- IT'S FUCKING "King's Raid" -- fucking sanitize the input I guess -- made an absolute ghetto fix by enclosing the series string in ' instead of "       -- this *will* break        --limit = 9000,    }    local seriesAll = cargo.query("loliInfoCleaned",qFields, qArgs)    --mw.logObject(seriesAll)

--create one entry for each series local seriesList = {} for i,series in ipairs(seriesAll) do       local seriesTable = strSplit(series["Series"],",") for i,seriesi in ipairs(seriesTable) do           local series = trim(seriesi:gsub(" -%(.*%) -",""):gsub(" -%[.*%] -",""):gsub(" -%{.*%} -","")) --mw.logObject(series) if not inTab(seriesList,series) then --mw.logObject(series .. " not yet added to list, adding") table.insert(seriesList,series) end end end mw.logObject(seriesList)

--start to assemble list

local listString = "" for i,series1 in ipairs(seriesList) do       --local localSeriesList = {} local cardString = "" --for i,Lseries in ipairs(seriesAll) do       --    if Lseries["Series"]:find(series1) then --       mw.logObject("series" .. Lseries["Series"]) --       table.insert(localSeriesList,Lseries["Series"]) --   end --end --for i,Lseries in ipairs(localSeriesList) do       cardString = cardString .. tostring(listBySeries(series1)) --end --mw.logObject(series1) --listBySeries(series1) --mw.logObject(listBySeries(series1)) listString = listString .. "| style='height:12px;background:#70547c;border: 2px solid #70547c' colspan=2 |\n" listString = listString .. "|-\n" listString = listString .. "| style='background:#17111b;text-align:center;color:#eee;font-weight:bold;font-size:25px;font-family:%'Franklin Gothic%';border: 2px solid #70547c' colspan=2 | " .. series1 .. " \n" listString = listString .. "|-\n" listString = listString .. "| style='background:#70547c;border: #70547c 2px solid' | " .. cardString .. "\n" listString = listString .. "|-\n" end

--PROBLEM: I'm searching for exact matches in title, so anything that has a custom link isn't counted in the listbytype cargo query --is there a "contains" taht works in cargo query?

return listString end

return p