or source == "fossilworks"
or source == "WoRMS" or source == "worms"
or source == "POWO" or source == "powo"
or source == "WFO" or source == "wfo"
or source == "AlgaeBase"
-- and so on
then return p._main(,data[source])
else
---
-- is there a point in the default if it needs the named object/table?
return p._main(,data[source])
end
end
p._main = function(, source)  
--TODO in modular version source will be provided in arguments
--local source = mw.getCurrentFrame:getParent.args[1]
local chapterParams = {} -- used for cite book (only MSW3 at moment)  
if not source then return "Error: unrecognised source." end  
local title, url = initialise(, source)  
--taxon related parameters
local genus, species, subspecies  
if source.db ~= "col" then -- col legacy uses positional parameters differently
genus, species, subspecies = getGenusSpecies
end  
local family = templateArgs['family']
local order = templateArgs['order']
local taxon = templateArgs['taxon']  
local id = templateArgs['id'] --id related parameters
local spid = templateArgs['spid'] or templateArgs['species_id']
local genid = templateArgs['genid'] or templateArgs['genus_id']
local citation = templateArgs['citation']
local collection = templateArgs['collection'] or templateArgs['collection_no']
local search = templateArgs['search']
local mode, value  
-- the functions
if genus and species and source.species then
title, url = source.species(genus,species,subspecies)
else -- functions with just their own name as parameter  
if genus then mode = "genus"; value = genus
elseif family then mode = "family"; value = family
elseif order then mode = "order"; value = order
elseif taxon then mode = "taxon"; value = taxon
elseif id then mode = "id"; value = id
elseif spid then mode = "spid"; value = spid
elseif genid then mode = "genid"; value = genid
elseif search then mode = "search"; value = search
elseif citation then mode = "citation"; value = citation
elseif collection then mode = "collection"; value = collection
else
-- no suitable parameter (use default page)
if source.default then
title, url, chapterParams = source.default(title, url)
end
end
end
if mode then
if source[mode] then
title, url, chapterParams = source[mode](value)
elseif data.default[mode] then
title, url, chapterParams = data.default[mode](value, source)
else
if source.error then return source.error end -- custom error message
return "Error: parameter not supported for this source" .. " (" .. mode .. ")"
end
else
-- if no mode then use the default title and url set by initialize
end  
if source.citeTemplate == "Cite book" then
return p.citeBook(, title, url, chapterParams)
end
return p.citeWeb(, title, url)  
end -- End the function.  
p.Reference = function  
local refs = require('Module:FishRef/refs')
getArgs(, templateArgs)  
if templateArgs[2] then
local reference = mw.text.trim(templateArgs[2])
if reference ~= "" and refs[reference] then
if templateArgs['pages'] then
refs[reference] = refs[reference]:gsub("}}", "|pages="..templateArgs['pages'].."}}")
refs[reference] = refs[reference]:gsub("|pages=[^|{}%[%]]*(|[^|{}}%[%]]*|pages=)", "%1")
end
if templateArgs['reftags'] == "yes" then
refs[reference] = ''
end
if templateArgs['expand'] and templateArgs['expand']=='no' or templateArgs['raw'] then
return refs[reference]
else
return :preprocess(refs[reference])
end
else
return 'Reference not found: "' .. templateArgs[2] .. '"'
end
end
return "Reference parameter missing."
end -- End the function.  
-- All modules end by returning the variable containing its functions to Wikipedia.
return p