searchStr ="/taxon/wfo-", -- not strictly search string
defaultSuffix = "",
--defaultTitle = "World Flora Online"
defaultTitle = "An Online Flora of All Known Plants"
}  
}
data.WFO.id = function(id)
-- http://www.worldfloraonline.org/taxon/wfo-4000012284  
local title = id
local url = data.WFO.customArgs['baseURL'] .. data.WFO.customArgs['searchStr'] .. id
return title, url
end
data.WFO.family = function(family)
local title = addAuthority(family)
local url = data.WFO.customArgs['baseURL'] .. data.WFO.customArgs['searchStr'] .. templateArgs['id']
return title, url
end
data.WFO.genus = function(genus)
local title = addAuthority("*" .. genus .. "*")
local url = data.WFO.customArgs['baseURL'] .. data.WFO.customArgs['searchStr'] .. templateArgs['id']
return title, url
end
data.WFO.species = function(genus,species)
local title = addAuthority("*" .. genus .. " " .. species .. "*")
local url = data.WFO.customArgs['baseURL'] .. data.WFO.customArgs['searchStr'] .. templateArgs['id']
return title, url
end
data.WFO.error = function
return "Requires id and title parameters"
end  
data.Tropicos = {
citationArgs = {
website="Tropicos",
--publisher="Missouri Botanical Gardens",
--postscript = '',
},
customArgs = { exclude = "id,1",
baseURL = "http://legacy.tropicos.org/Name/",
searchStr ="",
defaultSuffix = "",
defaultTitle = "Tropicos"
}  
}
data.Tropicos.id = function(id)
-- hhttp://legacy.tropicos.org/Name/100444532  
local title = id
local url = data.Tropicos.customArgs['baseURL'] .. data.Tropicos.customArgs['searchStr'] .. id
return title, url
end
data.Tropicos.error = function
return "Requires id and title parameters"
end  
data.FNA = {
citationArgs = {
website="Flora of North America",
--publisher="http://www.efloras.org",
--postscript = '',
},
customArgs = { exclude = "id,1",
baseURL = "http://www.efloras.org/florataxon.aspx",
searchStr ="?flora_id=1&taxon_id=",
defaultSuffix = "",
defaultTitle = "Flora of North America"
}
--id = function(id) return p.genericIdCitation (, title, url)
}
data.FNA.id = function(id)
-- http://www.efloras.org/florataxon.aspx?flora_id=1&taxon_id=125683  
local title = id
local url = data.FNA.customArgs['baseURL'] .. data.FNA.customArgs['searchStr'] .. id
return title, url
end
data.FNA.error = function
return "Requires id and title parameters"
end
-- ATRP: Australian Tropical Rainforest Plants  
data.ATRP = {
citationArgs = {
website="Australian Tropical Rainforest Plants",
publisher="Commonwealth Scientific and Industrial Research Organisation (CSIRO)",
version = "Edition 8",
year = 2020,
--postscript = '',
last1= "Zich", first1="F. A.",
last2= "Hyland", first2= "B. P. M.", ['author2-link']="Bernard Hyland",
last3= "Whiffin", first3= "T.",
last4= "Kerrigan", first4= "R.A.",
--['display-authors']=3,
},
customArgs = { exclude = "genus, species,authority, id,1",
baseURL = "https://apps.lucidcentral.org/rainforest",
searchStr ="/text/entities/",
defaultSuffix = ".htm",
defaultTitle = "Australian Tropical Rainforest Plants"
}
--id = function(id) return p.genericIdCitation (, title, url)
}
data.ATRP.species = function(genus,species)
-- https://apps.lucidcentral.org/rainforest/text/entities/buckinghamia_celsissima.htm  
local title = addAuthority("*" .. genus .. " " .. species .. "*") --"*" .. genus .. " " .. species .. "*"
local url = data.ATRP.customArgs['baseURL'] .. data.ATRP.customArgs['searchStr'] .. genus .. "_" .. species .. data.ATRP.customArgs['defaultSuffix']
return title, url
end
data.ATRP.error = function
return "Requires genus and species parameters"
end  
-- ============================= Mosses (Goffinet's site) =================================================-- for species in taxon; for species assessments, us
-- https://bryology.uconn.edu/classification/#Hypnanae
-- https://bryology.uconn.edu/classification/#Bryales
data.goffinet = {
citationArgs = {
first1="B.", last1="Goffinet",
first2="W.R.", last2="Buck",
website="Classification of extant moss genera"
--publisher="xxx"
},
customArgs = { exclude="family,genus,species,taxon,id,1",
baseURL = "https://bryology.uconn.edu/classification/",
searchString = "#",
searchSuffix = "",
defaultSuffix = "",
defaultTitle="Classification of the Bryophyta"
}
}
data.goffinet.genus = function(genus) return data.goffinet.taxon(genus, "GENUS") end
data.goffinet.family = function(family) return data.goffinet.taxon(family, "FAMILY") end
data.goffinet.order = function(order) return data.goffinet.taxon(order, "ORDER") end
data.goffinet.taxon = function(taxon, rank)
local title = firstToUpper(taxon)
if rank == "GENUS" then title = "*" .. title .. "*" end
if not (rank == "GENUS" or rank == "FAMILY") then -- upper case anchors for orders and above
if taxon ~= "Bryanae" and taxon ~= "Hypnanae" and taxon ~= "Bryales" and taxon ~= "Bryidae" then -- check for exceptions (inconsistencies at website)
taxon = taxon:upper
end
end
local url = data.goffinet.customArgs['baseURL'] .. data.goffinet.customArgs['searchString'] .. taxon .. data.goffinet.customArgs['searchSuffix']
return title, url
end  
-- AlgaeBase
taxonomy browser url (Volvox) = https://www.algaebase.org/browse/taxonomy/?id=6898
genus article url (Volvox) = https://www.algaebase.org/search/genus/detail/?genus_id=43497 (different id)
genus article url (Torodinium)= https://www.algaebase.org/search/genus/detail/?genus_id=44698
Please cite this record as: M.D. Guiry in Guiry, M.D. & Guiry, G.M. 2020. AlgaeBase.
World-wide electronic publication, National University of Ireland, Galway.
http://www.algaebase.org; searched on 10 May 2020.  
data.AlgaeBase = {
citationArgs = {
website="AlgaeBase",
['editor1-last']="Guiry", ['editor1-first']="M.D.",
['editor2-last']="Guiry", ['editor2-first']="G.M.",
publisher="National University of Ireland, Galway",
},
customArgs = { exclude = "id,1,genus_id,species_id,spid,genid",
baseURL = "https://www.algaebase.org/",
searchStr ="browse/taxonomy/?id=",
defaultSuffix = "",
defaultTitle = "AlgaeBase"
}
}
data.AlgaeBase.id = function(id)
-- https://www.algaebase.org/browse/taxonomy/?id=6898 (id for taxonomy page)  
local title = id
local url = data.AlgaeBase.customArgs['baseURL'] .. data.AlgaeBase.customArgs['searchStr'] .. id
return title, url
end
data.AlgaeBase.genid = function(genid)
-- https://www.algaebase.org/search/genus/detail/?genus_id=43497 (different id for genus page)  
local title = genid
local url = data.AlgaeBase.customArgs['baseURL'] .. "search/genus/detail/?genus_id=" .. genid
return title, url
end
data.AlgaeBase.spid = function(spid)
-- https://www.algaebase.org/search/species/detail/?species_id=52713 (id for species page)  
local title = spid
local url = data.AlgaeBase.customArgs['baseURL'] .. "search/species/detail/?species_id=" .. spid
return title, url
end
data.AlgaeBase.error = function
return "Requires id and title parameters"
end
--############################## General Functions ########################################  
local function getArgs (, args)
local parents = mw.getCurrentFrame:getParent  
for k,v in pairs(parents.args) do
--check content
if v and v ~= "" then
args[k]=v --parents.args[k]
end
end
for k,v in pairs(.args) do
--check content
if v and v ~= "" then
args[k]=v
end
end
end
local function initialise(, sourceDB)  
target=sourceDB
templateArgs = sourceDB.citationArgs -- get custom arguments for target (fishbase, cof etc  
getArgs(, templateArgs) -- get template arguments from parent and frane  
local url = (target.customArgs['baseURL'] or "") .. (target.customArgs['defaultSuffix'] or "")
local title = target.customArgs['defaultTitle'] or ""
return title, url
end
-- moved up top for scope
local function firstToUpper2(str)
return (str:gsub("^%l", string.upper))
end
-- clear template arguments that won't be recognised by
local function clearCustomArgs  
local excludeTable = { 'genus', 'species', 'subspecies', 'family', 'order', 'taxon',
'id', 'search' , 'citation', 1, 2, 3, 4 } -- add defaults ?  
if target.customArgs['exclude'] then