Module:DossiersTable

local p = {} function p.dossierList( f ) local args = f:getParent.args local elementWidth = tonumber(args.elementWidth) ~= nil and args.elementWidth or 180

local isSpecies = true local species, modName, linkPrefix = , nil,  local dossiers = {} for _,arg in ipairs(args) do   if isSpecies then -- if species is part of a mod, the species is expected to have the format "Mod:[ModName]:[Species]" modName, species = string.match(arg, '^Mod:([^:]+):(.+)$') if species == nil then species = arg linkPrefix = '' else linkPrefix = 'Mod:'..modName..'/' end else local link = linkPrefix..species local linkName = species if linkPrefix == '' then linkName = nil end if arg == 'Book' then table.insert(dossiers, {d = p.dossierImage(species, elementWidth, species, modName), l = link, ln = linkName}) else table.insert(dossiers, {d = '', l = link, ln = linkName}) end end isSpecies = not isSpecies end

local results = {} for i=1, #dossiers do   table.insert(results, ' '..dossiers[i].d..' '..dossiers[i].ln or '') .. '  ') end

return table.concat(results) end

function p.dossierImage(species,width,link,modName) local modFilePrefix, modSpeciesNamePrefix = ,  if modName ~= nil then -- set modName to the prefix that all mod-files should use modFilePrefix = 'Mod '..modName..' ' -- set modSpeciesNamePrefix to the prefix that all mod species should have modSpeciesNamePrefix = 'Mod:'..modName..'/' end

-- grab species name from file name File:Dossier Species.png or Dossier Species.png or use parameter local diname = string.match(species, '^File:Dossier[ _]([^.]*)%.png$') if diname == nil then diname = string.match(species, '^Dossier[ _]([^.]*)%.png$') end if diname == nil then diname = species end if width == nil then width = 4000 end width = string.match(width, '%d*') -- only the digits from second parameter local height = math.floor(width * 2660 / 4000 + 0.5) -- scaled height according to requested width if link == nil then -- check for link link = '' else link = '|link='..modSpeciesNamePrefix..link end

local result = ' ' -- container with size .. ' ' -- book as background .. ' ' -- dossier pages of the creature .. ' ' return result end

return p