Module:ofs-decl-noun

Hello, you have come here looking for the meaning of the word Module:ofs-decl-noun. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:ofs-decl-noun, but we will also tell you about its etymology, its characteristics and you will know how to say Module:ofs-decl-noun in singular and plural. Everything you need to know about the word Module:ofs-decl-noun you have here. The definition of the word Module:ofs-decl-noun will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:ofs-decl-noun, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

local m_links = require("Module:links")
local m_utils = require("Module:utilities")

local lang = require("Module:languages").getByCode("ofs")

local decl_data = {}

decl_data = {
	params = {
		 = {},
		 = {},
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "masculine a-stem"
	
	local a2 = args or args
	
	data.forms = {args.pal or args}
	data.forms = {args.pal or args}
	data.forms = {(args.pal or (args or (args .. "e"))) .. "s"}
	data.forms = {args.pal or (args or (args .. "e"))}

	if not args.nopl then
		data.forms = {a2 .. "ar", a2 .. "a"}
		data.forms = {a2 .. "ar", a2 .. "a"}
		data.forms = {a2 .. "a"}
		data.forms = {a2 .. "um", a2 .. "em"}
	end
	
	table.insert(data.categories, "Old Frisian a-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "neuter a-stem"

	local a2 = args or args
	
	data.forms = {args}
	data.forms = {args}
	data.forms = {(args or (args .. "e")) .. "s"}
	data.forms = {args or (args .. "e")}

	if not args.nopl then
		data.forms = {args.short and (a2 .. "e") or args, args.short and (a2 .. "u")}
		data.forms = {args.short and (a2 .. "e") or args, args.short and (a2 .. "u")}
		data.forms = {a2 .. "a"}
		data.forms = {a2 .. "um", a2 .. "em"}
	end
	
	table.insert(data.categories, "Old Frisian a-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "masculine consonant stem"
	
	local a3 = args or args
	
	data.forms = {args}
	data.forms = {args}
	data.forms = {a3 .. "es"}
	data.forms = {a3 .. "e"}

	if not args.nopl then
		data.forms = {args or args}
		data.forms = {args or args}
		data.forms = {a3 .. "a"}
		data.forms = {a3 .. "um", a3 .. "em"}
	end
	
	table.insert(data.categories, "Old Frisian consonant stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	decl_data(args, data)
	
	data.decl_type = "feminine consonant stem"

	data.forms = (args or args) .. "e"
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		 = {},
		},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "feminine i-stem"

	data.forms = {args .. (args.short and "e" or "")}
	data.forms = {args .. (args.short and "e" or "")}
	data.forms = {args .. "e"}
	data.forms = {args .. "e"}

	if not args.nopl then
		data.forms = {args .. "a"}
		data.forms = {args .. "a"}
		data.forms = {args .. "a", args .. "ena"}
		data.forms = {args .. "um", args .. "em"}
	end
	
	table.insert(data.categories, "Old Frisian i-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "masculine ja-stem"

	data.forms = {args .. "e"}
	data.forms = {args .. "e"}
	data.forms = {args .. "es"}
	data.forms = {args .. "e"}

	if not args.nopl then
		data.forms = {args .. "ar", args .. "a"}
		data.forms = {args .. "ar", args .. "a"}
		data.forms = {args .. "a"}
		data.forms = {args .. "um", args .. "em"}
	end
	
	table.insert(data.categories, "Old Frisian ja-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "neuter ja-stem"

	local a2 = args or args
	
	data.forms = {args .. (args.short and "e" or "")}
	data.forms = {args .. (args.short and "e" or "")}
	data.forms = {a2 .. "es"}
	data.forms = {a2 .. "e"}

	if not args.nopl then
		data.forms = {args.short and (args .. "e") or (a2 .. "e"), args.short and (a2 .. "u")}
		data.forms = {args.short and (args .. "e") or (a2 .. "e"), args.short and (a2 .. "u")}
		data.forms = {a2 .. "a"}
		data.forms = {a2 .. "um", a2 .. "em"}
	end
	
	table.insert(data.categories, "Old Frisian ja-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "masculine n-stem"

	data.forms = {args .. "a"}
	data.forms = {args .. "a"}
	data.forms = {args .. "a"}
	data.forms = {args .. "a"}

	if not args.nopl then
		data.forms = {args .. "a"}
		data.forms = {args .. "a"}
		data.forms = {args .. "ena"}
		data.forms = {args .. "um", args .. "em"}
	end
	
	table.insert(data.categories, "Old Frisian n-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		},
}
setmetatable(decl_data, {__call = function(self, args, data)
	decl_data(args, data)
	
	data.decl_type = "weak feminine n-stem"
	
	data.forms = {args .. "e"}
	data.forms = {args .. "an, -a"}
	data.forms = {args .. "u, -m"}
	
end
})

decl_data = {
	params = {
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	decl_data(args, data)
	
	data.decl_type = "neuter n-stem"
	
	data.forms = {args .. "e"}
	data.forms = {args .. "e"}
	
	if not args.nopl then
		data.forms = args .. "ene"
		data.forms = args .. "ne"
		data.forms = args .. "ene"
		data.forms = args .. "ne"
		data.forms = args .. "num"
		data.forms = args .. "nem"
	end
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "ō-stem"
	
	data.forms = {args .. "e"}
	data.forms = {args .. "e"}
	data.forms = {args .. "e"}
	data.forms = {args .. "e"}

	if not args.nopl then
		data.forms = {args .. "a"}
		data.forms = {args .. "a"}
		data.forms = {args .. "a", args .. "ena"}
		data.forms = {args .. "um", args .. "em", args .. "on"}
	end

	table.insert(data.categories, "Old Frisian ō-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
		},
}
setmetatable(decl_data, {__call = function(self, args, data)
	data.decl_type = "feminine r-stem"
	
	data.forms = {args .. "er"}
	data.forms = {args .. "er"}
	data.forms = {args .. "er", args .. "ere"}
	data.forms = {args .. "er", args .. "ere"}

	if not args.nopl then
		data.forms = {args .. "er", args .. "era"}
		data.forms = {args .. "er", args .. "era"}
		data.forms = {args .. "era"}
		data.forms = {args .. "rum", args .. "rem", args .. "erum", args .. "erem"}
	end

	table.insert(data.categories, "Old Frisian r-stem nouns")
end
})

decl_data = {
	params = {
		 = {},
		 = {},
	},
}
setmetatable(decl_data, {__call = function(self, args, data)
	decl_data(args, data)
	
	data.decl_type = "masculine r-stem"
	
	data.forms = args .. "eres"
end
})

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)

	local parent_args = frame:getParent().args
	local decl_type = (frame.args or parent_args) or "a-m"

	if not decl_data then
		error("Unknown declension '" .. decl_type .. "'")
	end
	
	local data = {forms = {}, categories = {}}
	
	data.head = parent_args or nil

	local args = require("Module:parameters").process(parent_args, decl_data.params, true)
	
	-- Override for templates
	if not args then
		setmetatable(args, {__index = function(self, key)
			return "{{{" .. key .. "}}}"
		end
		})
	end
	
	-- Generate the forms
	if parent_args.irr then
		table.insert(data.categories, "Old Frisian irregular nouns")
		if decl_data.irregular then
			decl_data.irregular(data)
		else
			decl_data(args, data)
		end
	else
		decl_data(args, data)
	end

	-- Make the table
	return make_table(data)
end

function make_table(data)
	local function show_form(form)
		if not form then
			return "—"
		end
		
		local ret = {}
		
		for key, subform in ipairs(form) do
			if mw.title.getCurrentTitle().nsText == "Reconstruction" and subform ~= "—" then
				subform = "*" .. subform
			end
			table.insert(ret, m_links.full_link({lang = lang, term = subform}))
		end
			
		return table.concat(ret, ", ")
	end
	
	local function repl(param)
		if param == "decl_type" then
			return data.decl_type
		else
			return show_form(data.forms)
		end
	end

	local wikicode = mw.getCurrentFrame():expandTemplate{ 
		title = 'inflection-table-top', 
		args = {
			title = "Declension of ''{{{nom_sg}}}'' ({{{decl_type}}})",
			palette = 'green',
			tall = 'yes',
		}
	} .. [=[
! 
! singular
! plural
|- 
! ]
| {{{nom_sg}}}
| {{{nom_pl}}}
|- 
! ]
| {{{acc_sg}}}
| {{{acc_pl}}}
|- 
! ]
| {{{gen_sg}}}
| {{{gen_pl}}}
|- 
! ]
| {{{dat_sg}}}
| {{{dat_pl}}}
]=] .. mw.getCurrentFrame():expandTemplate{ title = 'inflection-table-bottom' }

	return (mw.ustring.gsub(wikicode, "{{{(+)}}}", repl)) .. m_utils.format_categories(data.categories, lang)
end

return export