Module:cs-ijpdecl

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


local export = {}

local rsplit = mw.text.split
local rmatch = mw.ustring.match

local recognized_cases = require("Module:table/listToSet") {
	"nominative",
	"genitive",
	"dative",
	"accusative",
	"vocative",
	"locative",
	"instrumental",
}

local slot_to_index = {
	 = 1,
	 = 2,
	 = 3,
	 = 4,
	 = 5,
	 = 6,
	 = 7,
	 = 8,
	 = 9,
	 = 10,
	 = 11,
	 = 12,
	 = 13,
	 = 14,
}

function export.ijpdecl(frame)
	local params = {
		 = {required = true}
	}
	local parargs = frame:getParent().args
	local args = require("Module:parameters").process(parargs, params)
	local function get_orig()
		return "original follows: {{temp|cs-ijpdecl|" .. args .. "}}"
	end

	local function normalize_caseform(caseform)
		local forms = rsplit(caseform, " *, *")
		local need_brackets = #forms > 1
		for i, form in ipairs(forms) do
			-- remove footnotes
			form = form:gsub("*$", "")
			if need_brackets then
				form = "]"
			end
			forms = form
		end
		return table.concat(forms, ", ")
	end

	local outargs = {}
	local function process_line(line)
		local case, sg, pl = rmatch(line, "^(.-)\t(.-)\t(.-)$")
		if not case then
			return ("Not enough parts on line '%s'; "):format(line) .. get_orig()
		end
		if not recognized_cases then
			return ("Unrecognized case '%s'; "):format(case) .. get_orig()
		end
		case = case:sub(1, 3)
		outargs] = normalize_caseform(sg)
		outargs] = normalize_caseform(pl)
	end

	local forms = mw.text.trim(args)

	for _, line in ipairs(rsplit(forms, "\n")) do
		local errmsg = process_line(line)
		if errmsg then
			return errmsg
		end
	end

	local parts = {}
	for i = 1, 7 do
		table.insert(parts, outargs or "")
	end
	local sg = table.concat(parts, "|")
	parts = {}
	for i = 8, 14 do
		table.insert(parts, outargs or "")
	end
	local pl = table.concat(parts, "|")
	return ("{{cs-decl-noun\n|%s\n|%s\n}}"):format(sg, pl)
end

return export