if para1 ~= "" then
url = "https://www.catalogueoflife.org/data/search?q=" .. para1
title = "''" .. para1
if para2 then
url = url .. "+" .. para2
title = title .. " " .. para2
end
url = url .. "&type=EXACT"
title = title .. "''"
end  
end
if para3 then title = title .. " " .. para3 end -- add authority
if para4 == "nv" then templateArgs['trans-title'] = "synonym" end -- if nv add [synonym]. Note that this parameter is not used to add COinS metadata
else
-- no parameter 1
end  
return title, url
end  
--====================== Fossilworks =======================================  
data.fossilworks = {
citationArgs = {
website="Fossilworks",
--publisher="Paleobiology Database",
--postscript = '',
postscript = "&#32;from the Paleobiology Database.",
--via="*fossilworks.org*" -- an alternative format to using |website=
},
customArgs = { exclude = "id,collection,date,1",
baseURL = "http://www.fossilworks.org/cgi-bin/",
searchStr ="bridge.pl?a=taxonInfo&taxon_no=",
defaultTitle = "Fossilworks: Gateway to the Paleobiology Database"
}
--id = function(id) return p.genericIdCitation (, title, url)
}
data.fossilworks.id = function(id)
--[[ http://fossilworks.org/cgi-bin/bridge.pl?a=taxonInfo&taxon_no=83087
if not templateArgs['id'] then return "no id parameter detected" end
local searchStr = "bridge.pl?a=taxonInfo&taxon_no=" .. templateArgs['id']
templateArgs['url']= target.CustomArgs['baseURL'] .. searchStr
local title = "PaleoDB taxon number: " .. id
local url = data.fossilworks.customArgs['baseURL'] .. data.fossilworks.customArgs['searchStr'] .. id
return title, url
end
data.fossilworks.collection = function(collection)
-- http://fossilworks.org/bridge.pl?a=collectionSearch&collection_no=20072
local title = "PaleoDB collection number: " .. collection
local url = data.fossilworks.customArgs['baseURL'] .. "bridge.pl?a=collectionSearch&collection_no=" .. collection
return title, url
end
data.fossilworks.error = function
return "Requires id and title parameters"
end  
--====================== Paleobiology Database: paleobiodb.org =======================================  
data.paleobiodb = {
citationArgs = {
website="Paleobiology Database"
},
customArgs = { exclude = "id,collection,date,1",
baseURL = "https://paleobiodb.org/classic/",
searchStr ="basicTaxonInfo?taxon_no=",
defaultTitle = "Paleobiology Database"
}
--id = function(id) return p.genericIdCitation (, title, url)
}
data.paleobiodb.id = function(id)
--[[ https://paleobiodb.org/classic/basicTaxonInfo?taxon_no=22786
if not templateArgs['id'] then return "no id parameter detected" end
local title = "PaleoDB taxon number: " .. id
local url = data.paleobiodb.customArgs['baseURL'] .. data.paleobiodb.customArgs['searchStr'] .. id
return title, url
end
data.paleobiodb.collection = function(collection)
-- https://paleobiodb.org/classic/basicCollectionSearch?collection_no=24193
local title = "PaleoDB collection number: " .. collection
local url = data.paleobiodb.customArgs['baseURL'] .. "basicCollectionSearch?collection_no=" .. collection
return title, url
end
data.paleobiodb.error = function
return "Requires id and title parameters"
end
--======================================= PLANTS =========================
-- Plant authorities can end in a period. This is stripped by the citation templates.
This function encloses titles ending in such authorities in double parentheses, i.e. ((title))  
local addAuthority = function(formattedTaxonName)
if templateArgs['authority'] then
local title = formattedTaxonName .. " " .. templateArgs['authority']
return string.gsub( title, "(.*%.)$", "((%1))") -- if authority ends in "." enclose ((title)) to prevent removal
end
return formattedTaxonName
end  
-- Hassler, Michael (2004 - 2020): World Plants. Synonymic Checklist and Distribution of the World Flora.
Version x.xx; last update xx.xx.xxxx. - www.worldplants.de. Last accessed dd/mm/yyyy.
https://www.worldplants.de/world-plants-complete-list/complete-plant-list#1599996425
Hassler, Michael (2004 - 2020): World Ferns. Synonymic Checklist and Distribution of Ferns and Lycophytes of the World.
Version x.xx; last update xx.xx.xxxx. - www.worldplants.de/ferns/. Last accessed dd/mm/yyyy.
https://www.worldplants.de/world-ferns/ferns-and-lycophytes-list#1599997555  
deeplinks:
Genus: *Helosciadium*
Species: *Helosciadium longipedunculatum*  
Genus: *Lycopodium*
Species: *Lycopodium clavatum*  
---
data.worldplants = {
citationArgs = {
last1 = "Hassler", first1 = "Michael",
website="World Plants. Synonymic Checklist and Distribution of the World Flora.",
--publisher=""
},
customArgs = { exclude = "id,authority,family,genus,species,1",
baseURL = "https://www.worldplants.de",
searchStr ="/world-plants-complete-list/complete-plant-list#",
defaultSuffix = "",
defaultTitle = "World Plants"
}
}
data.worldplants.genus = function(genus)
local title = addAuthority("*" .. genus .. "*")
local genusString = genus
if templateArgs['authority'] then genusString = genus .. "-" .. templateArgs['authority'] end
local url = data.worldplants.customArgs['baseURL'] .. "?deeplink=" .. genusString
return title, url
end
data.worldplants.species = function(genus, species)
local title = addAuthority("*" .. genus .. " " .. species .. "*")
local url = data.worldplants.customArgs['baseURL'] .. "?deeplink=" .. genus .. "-" .. species .. " " .. (templateArgs['authority'] or "")
return title, url
end
--[[ experimental, don't leave live  
data.worldplants.taxon = function(taxon)
local title = taxon .. " " .. (templateArgs['authority'] or "")
local url = data.worldplants.customArgs['baseURL'] .. "?deeplink=" .. taxon
return title, url
end  
data.worldplants.family = function(family)
local title = family .. " " .. (templateArgs['authority'] or "")
local url = data.worldplants.customArgs['baseURL'] .. "?deeplink=" .. family
return title, url
end
--]]
data.worldferns = {
citationArgs = {
last1 = "Hassler", first1 = "Michael",
website="World Ferns. Synonymic Checklist and Distribution of the World Flora.",
--publisher=""
},
customArgs = { exclude = "id,authority,family,genus,species,1",
baseURL = "https://www.worldplants.de/",
searchStr ="world-ferns/ferns-and-lycophytes-list?name=",
defaultSuffix = "",
defaultTitle = "World Ferns"
}
}
data.worldferns.genus = function(genus)
local title = addAuthority("*" .. genus .. "*")
local genusString = genus
if templateArgs['authority'] then genusString = genus .. "-" .. templateArgs['authority'] end
local url = data.worldferns.customArgs['baseURL'] .. data.worldferns.customArgs['searchStr'] .. genusString
return title, url
end
data.worldferns.species = function(genus, species)
local title = addAuthority("*" .. genus .. " " .. species .. "*")
local url = data.worldferns.customArgs['baseURL'] .. data.worldferns.customArgs['searchStr'] .. genus .. "-" .. species .. " " .. (templateArgs['authority'] or "")
return title, url
end  
--[[Plants of the World online
http://powo.science.kew.org/taxon/urn:lsid:ipni.org:names:30003057-2 -- use id
http://powo.science.kew.org/?q=Selaginellaceae -- use search
http://powo.science.kew.org/?family=Selaginellaceae -- can also use family= [gets same result as q=]
http://powo.science.kew.org/?genus=Selago -- or genus
http://powo.science.kew.org/?genus=Selago&species=abietina -- or genus + species
http://powo.science.kew.org/?genus=Selago&f=accepted_names -- filter for accepted names
http://powo.science.kew.org/?genus=Selago&f=genus_f -- filter for genus (no species selected)
http://powo.science.kew.org/?genus=Selago&f=genus_f%2Caccepted_names -- filter for genus and accepted names
http://powo.science.kew.org/?page.size=480&f=family_f%2Caccepted_names -- list of accepted families
-- all these searches get the search result (no apparent way to target the article when unique)
data.POWO = {
citationArgs = {
website="Plants of the World Online",
publisher="Royal Botanic Gardens, Kew",
--postscript = '',
},
customArgs = { exclude = "id,authority,family,genus,species,1",