<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.digitalcellulose.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AGender_and_number</id>
	<title>Module:Gender and number - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.digitalcellulose.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AGender_and_number"/>
	<link rel="alternate" type="text/html" href="https://www.digitalcellulose.com/wiki/index.php?title=Module:Gender_and_number&amp;action=history"/>
	<updated>2026-04-28T05:13:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://www.digitalcellulose.com/wiki/index.php?title=Module:Gender_and_number&amp;diff=98244&amp;oldid=prev</id>
		<title>Adminsuzy: Created page with &quot;--[=[ 	This module creates standardised displays for gender and number. 	It converts a gender specification into Wiki/HTML format. 	 	A gender specification is a list of one o...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.digitalcellulose.com/wiki/index.php?title=Module:Gender_and_number&amp;diff=98244&amp;oldid=prev"/>
		<updated>2018-08-27T20:27:05Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;--[=[ 	This module creates standardised displays for gender and number. 	It converts a gender specification into Wiki/HTML format. 	 	A gender specification is a list of one o...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[=[&lt;br /&gt;
	This module creates standardised displays for gender and number.&lt;br /&gt;
	It converts a gender specification into Wiki/HTML format.&lt;br /&gt;
	&lt;br /&gt;
	A gender specification is a list of one of the elements listed below,&lt;br /&gt;
	separated by hyphens. Examples are: &amp;quot;c&amp;quot;, &amp;quot;n&amp;quot;, &amp;quot;f-p&amp;quot;, &amp;quot;m-an-p&amp;quot;&lt;br /&gt;
]=]--&lt;br /&gt;
&lt;br /&gt;
local export = {}&lt;br /&gt;
&lt;br /&gt;
local codes = {}&lt;br /&gt;
&lt;br /&gt;
-- A list of all possible &amp;quot;parts&amp;quot; that a specification can be made out of.&lt;br /&gt;
&lt;br /&gt;
codes[&amp;quot;?&amp;quot;] = {type = &amp;quot;other&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;gender incomplete&amp;quot;&amp;gt;?&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
&lt;br /&gt;
-- Genders&lt;br /&gt;
codes[&amp;quot;m&amp;quot;] = {type = &amp;quot;gender&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;masculine gender&amp;quot;&amp;gt;m&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;f&amp;quot;] = {type = &amp;quot;gender&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;feminine gender&amp;quot;&amp;gt;f&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;n&amp;quot;] = {type = &amp;quot;gender&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;neuter gender&amp;quot;&amp;gt;n&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;c&amp;quot;] = {type = &amp;quot;gender&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;common gender&amp;quot;&amp;gt;c&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
&lt;br /&gt;
-- Animacy&lt;br /&gt;
codes[&amp;quot;an&amp;quot;] = {type = &amp;quot;animacy&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;animate&amp;quot;&amp;gt;anim&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;in&amp;quot;] = {type = &amp;quot;animacy&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;inanimate&amp;quot;&amp;gt;inan&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
&lt;br /&gt;
-- Personal&lt;br /&gt;
codes[&amp;quot;pr&amp;quot;] = {type = &amp;quot;personal&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;personal&amp;quot;&amp;gt;pers&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;np&amp;quot;] = {type = &amp;quot;personal&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;non-personal&amp;quot;&amp;gt;npers&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
&lt;br /&gt;
-- Numbers&lt;br /&gt;
codes[&amp;quot;s&amp;quot;] = {type = &amp;quot;number&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;singular number&amp;quot;&amp;gt;sg&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;d&amp;quot;] = {type = &amp;quot;number&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;dual number&amp;quot;&amp;gt;du&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;p&amp;quot;] = {type = &amp;quot;number&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;plural number&amp;quot;&amp;gt;pl&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
&lt;br /&gt;
-- Verb qualifiers&lt;br /&gt;
codes[&amp;quot;impf&amp;quot;] = {type = &amp;quot;perfectivity&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;imperfective aspect&amp;quot;&amp;gt;impf&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
codes[&amp;quot;pf&amp;quot;] = {type = &amp;quot;perfectivity&amp;quot;, display = '&amp;lt;abbr title=&amp;quot;perfective aspect&amp;quot;&amp;gt;pf&amp;lt;/abbr&amp;gt;'}&lt;br /&gt;
&lt;br /&gt;
-- Version of format_list that can be invoked from a template.&lt;br /&gt;
function export.show_list(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local lang = args[&amp;quot;lang&amp;quot;]; if lang == &amp;quot;&amp;quot; then lang = nil end&lt;br /&gt;
	local list = {}&lt;br /&gt;
	local i = 1&lt;br /&gt;
	&lt;br /&gt;
	while args[i] and args[i] ~= &amp;quot;&amp;quot; do&lt;br /&gt;
		table.insert(list, args[i])&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return export.format_list(list, lang)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Format one or more gender specifications, in the form of a table of specifications.&lt;br /&gt;
function export.format_list(list, lang)&lt;br /&gt;
	local is_nounclass = nil&lt;br /&gt;
	&lt;br /&gt;
	-- Iterate over each specification and format it&lt;br /&gt;
	for key, spec in ipairs(list) do&lt;br /&gt;
		local nc&lt;br /&gt;
		list[key], nc = export.format_specification(spec, lang)&lt;br /&gt;
		&lt;br /&gt;
		-- Ensure that the specifications are either all noun classes, or none are.&lt;br /&gt;
		if is_nounclass == nil then&lt;br /&gt;
			is_nounclass = nc&lt;br /&gt;
		elseif is_nounclass ~= nc then&lt;br /&gt;
			error(&amp;quot;Noun classes and genders cannot be mixed. Please use either one or the other.&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_nounclass then&lt;br /&gt;
		-- Add the processed codes together with slashes&lt;br /&gt;
		return &amp;quot;&amp;lt;span class=\&amp;quot;gender\&amp;quot;&amp;gt;class &amp;quot; .. table.concat(list, &amp;quot;/&amp;quot;) .. &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		-- Add the processed codes together with commas&lt;br /&gt;
		return &amp;quot;&amp;lt;span class=\&amp;quot;gender\&amp;quot;&amp;gt;&amp;quot; .. table.concat(list, &amp;quot;, &amp;quot;) .. &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Format the sub-parts of a single gender specification.&lt;br /&gt;
function export.format_specification(spec, lang)&lt;br /&gt;
	local categories = &amp;quot;&amp;quot;&lt;br /&gt;
	local ret = &amp;quot;&amp;quot;&lt;br /&gt;
	local is_nounclass = false&lt;br /&gt;
	&lt;br /&gt;
	-- If the specification starts with cX, then it is a noun class specification.&lt;br /&gt;
	if spec:find(&amp;quot;^[1-9]&amp;quot;) or spec:find(&amp;quot;^c[^-]&amp;quot;) then&lt;br /&gt;
		is_nounclass = true&lt;br /&gt;
		code = spec:gsub(&amp;quot;^c&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
		&lt;br /&gt;
		if code == &amp;quot;?&amp;quot; then&lt;br /&gt;
			ret = &amp;quot;&amp;lt;abbr class=\&amp;quot;noun-class\&amp;quot; title=\&amp;quot;noun class missing\&amp;quot;&amp;gt;?&amp;lt;/abbr&amp;gt;&amp;quot;&lt;br /&gt;
		else&lt;br /&gt;
			ret = &amp;quot;&amp;lt;abbr class=\&amp;quot;noun-class\&amp;quot; title=\&amp;quot;noun class &amp;quot; .. code .. &amp;quot;\&amp;quot;&amp;gt;&amp;quot; .. code .. &amp;quot;&amp;lt;/abbr&amp;gt;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local types = {}&lt;br /&gt;
		&lt;br /&gt;
		-- Split the parts and iterate over each part, converting it into its display form&lt;br /&gt;
		local parts = mw.text.split(spec, &amp;quot;-&amp;quot;)&lt;br /&gt;
		&lt;br /&gt;
		for key, code in ipairs(parts) do&lt;br /&gt;
			-- Is this code valid?&lt;br /&gt;
			if not codes[code] then&lt;br /&gt;
				error(&amp;quot;The gender specification \&amp;quot;&amp;quot; .. spec .. &amp;quot;\&amp;quot; is not valid.&amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if codes[code].type ~= &amp;quot;other&amp;quot; and types[codes[code].type] then&lt;br /&gt;
				require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;gender and number/multiple&amp;quot;)&lt;br /&gt;
				require(&amp;quot;Module:debug&amp;quot;).track(&amp;quot;gender and number/multiple/&amp;quot; .. spec)&lt;br /&gt;
				--error(&amp;quot;The gender specification \&amp;quot;&amp;quot; .. spec .. &amp;quot;\&amp;quot; contains multiple tags of type \&amp;quot;&amp;quot; .. codes[code].type .. &amp;quot;\&amp;quot;.&amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
				&lt;br /&gt;
			parts[key] = codes[code].display&lt;br /&gt;
			types[codes[code].type] = true&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Add the processed codes together with non-breaking spaces&lt;br /&gt;
		ret = table.concat(parts, &amp;quot;&amp;amp;nbsp;&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Do some additional checks if a language was given&lt;br /&gt;
	if lang then&lt;br /&gt;
		-- Is this an incomplete gender?&lt;br /&gt;
		if spec:find(&amp;quot;?&amp;quot;) then&lt;br /&gt;
			local m_utilities = require(&amp;quot;Module:utilities&amp;quot;)&lt;br /&gt;
			categories = m_utilities.format_categories({lang:getCanonicalName() .. &amp;quot; terms with incomplete gender&amp;quot;}, nil)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Check if the specification is valid&lt;br /&gt;
		--elseif langinfo.genders then&lt;br /&gt;
		--	local valid_genders = {}&lt;br /&gt;
		--	for _, g in ipairs(langinfo.genders) do valid_genders[g] = true end&lt;br /&gt;
		--	&lt;br /&gt;
		--	if not valid_genders[spec] then&lt;br /&gt;
		--		local valid_string = {}&lt;br /&gt;
		--		for i, g in ipairs(langinfo.genders) do valid_string[i] = g end&lt;br /&gt;
		--		error(&amp;quot;The gender specification \&amp;quot;&amp;quot; .. spec .. &amp;quot;\&amp;quot; is not valid for &amp;quot; .. langinfo.names[1] .. &amp;quot;. Valid are: &amp;quot; .. table.concat(valid_string, &amp;quot;, &amp;quot;))&lt;br /&gt;
		--	end&lt;br /&gt;
		--end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return ret .. categories, is_nounclass&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return export&lt;/div&gt;</summary>
		<author><name>Adminsuzy</name></author>
		
	</entry>
</feed>