Jump to content

Module:Science redirect/sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ahecht (talk | contribs) at 18:57, 31 May 2017 (update). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = {}

function p.from_alternative_scientific_name(frame)
	local catText = 'from alternative scientific name'
	local fromText = 'an alternative scientific name of an organism'
	local toText = 'the accepted scientific name'
	return p._main(frame, catText, fromText, toText)
end

local conf = { -- list entries minus any trailing 's'
	plant      = {'a plant', 'plants'},
	fish       = {'a fish', 'fish'},
	fishe      = {'a fish', 'fish'},
	fungu      = {'a fungus', 'fungi'},
	fungi      = {'a fungus', 'fungi'},
	spider     = {'a spider', 'spiders'},
	crustacean = {'a crustacean', 'crustaceans'},
	reptile    = {'a reptile', 'reptiles'},
	insect     = {'an insect', 'insects'},
	none       = {'an organism'},
}

function p._main(frame, catText, fromText, toText)
	local args = frame:getParent().args
	local singleNoun, pluralNoun = '', ''
	local cat = mw.ustring.match(mw.ustring.lower(args[1] or 'none'), '^(.-)s?$')
	return true
end

return p