Module:Gender and number/basic: Difference between revisions

Jump to navigation Jump to search
(Created page with "local export = {} --[=[ This is a simplified version of Module:gender and number that handles the most common cases without loading the full module. ]=]-- function exp...")
 
m (1 revision imported)
 

Latest revision as of 02:05, 10 June 2024

Documentation for this module may be created at Module:Gender and number/basic/doc

local export = {}

--[=[
	This is a simplified version of [[Module:gender and number]] that handles the most common
	cases without loading the full module.
]=]--

function export.format_list(specs, lang, pos_for_cat, sort_key)
	local gender, spec
	if not pos_for_cat and not sort_key and #specs == 1 and type(specs[1]) == "string" then
		spec = specs[1]
		if spec == "m" then
			gender = "masculine"
		elseif spec == "f" then
			gender = "feminine"
		elseif spec == "n" then
			gender = "neuter"
		elseif spec == "c" then
			gender = "common"
		end
	end

	if gender then
		return '<span class="gender"><abbr title="' .. gender .. ' gender">' .. spec .. '</abbr></span>'
	end

	return require("Module:gender and number").format_list(specs, lang, pos_for_cat, sort_key)
end

return export