Modul:mn-headword

Üdvözlöm, Ön a Modul:mn-headword szó jelentését keresi. A DICTIOUS-ban nem csak a Modul:mn-headword szó összes szótári jelentését megtalálod, hanem megismerheted az etimológiáját, a jellemzőit és azt is, hogyan kell a Modul:mn-headword szót egyes és többes számban mondani. Minden, amit a Modul:mn-headword szóról tudni kell, itt található. A Modul:mn-headword szó meghatározása segít abban, hogy pontosabban és helyesebben fogalmazz, amikor beszélsz vagy írsz. AModul:mn-headword és más szavak definíciójának ismerete gazdagítja a szókincsedet, és több és jobb nyelvi forráshoz juttat.

A modult a Modul:mn-headword/doc lapon tudod dokumentálni

local export = {}

local lang = require("Module:languages").getByCode("mn")
local m_scripts = require("Module:scripts")

local params = {
	 = {}, --with no diacritics I don't think we'll need more than one head
	 = {list = true},
	 = {list = true}
}

local function get_script(args) 
	return m_scripts.findBestScript(args or mw.title.getCurrentTitle().subpageText, lang)
end
	
local function otherscript(inflections, args, sc, categories)
	if #args < 1 then
		if sc then
			if sc:getCode() == "Mong" then
				table.insert(categories, "Mongolian terms without Cyrillic script")
			elseif sc:getCode() == "Cyrl" then
				table.insert(categories, "Mongolian terms without Mongolian script")
			end
		end
		return 
	end

	local other_sc
	
	local scripts = {
		m = "Mong",
		c = "Cyrl",
		Mong = true,
		Cyrl = true,
	}
	if scripts] then
		other_sc =  m_scripts.getByCode(scripts])
		table.remove(args, 1)
		require("Module:debug").track("mn-headword/script-param")
	else
		other_sc = m_scripts.findBestScript(args, lang)
	end
	
	if sc and sc:getCode() == other_sc:getCode() then
		error("The headword and the alternative spelling should be in different scripts.")
	end
	
	if not scripts then
		error("Mongolian entries in " .. other_sc:getCanonicalName() .. " script are not currently allowed.")
	end
	
	local spelling = {label = other_sc:getCanonicalName() .. " spelling", sc = other_sc, enable_auto_translit=true}
	
	for i, arg in ipairs(args) do
		table.insert(spelling, arg)
	end
	
	table.insert(inflections, spelling)
end

local function categorize(args)
	local cats = args
	local categories = {}
	if cats then
		for i, arg in ipairs(cats) do
			table.insert(categories, lang:getCanonicalName() .. " " .. arg)
		end
	end
	if (args or mw.title.getCurrentTitle().subpageText):find(" ") then
		table.insert(categories, lang:getCanonicalName() .. " multiword terms")
	end
	return categories
end

function export.basic(frame)
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local inflections = {}
	local categories = categorize(args)
	
	local sc = get_script(args)
	
	otherscript(inflections, args, sc, categories)
	
	local data = {lang = lang, sc = sc, heads = {args or ""}, genders = nil, inflections = inflections, pos_category = frame.args, categories = categories, sort_key = nil}
	return require("Module:headword").full_headword(data)
end

function export.noun(frame)

	params = {list = true}
	params = {}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local sc = get_script(args)
	
	local inflections = {}
	
	local categories = categorize(args)
	
	local declension = ""
	
	otherscript(inflections, args, sc, categories)
	
	if #args > 0 then
		local plurals = {label = "plural"}
		for i, pl in ipairs(args) do
			table.insert(plurals, pl)
		end
		table.insert(inflections, plurals)
	end

		
	if args then
		declension = "; <small><i>("
		if args == "r" then
			declension = declension .. "regular declension ]"
		elseif args == "n" then
			declension = declension .. "hidden-n declension ]"
		elseif args == "g" then
			declension = declension .. "hidden-g declension ]"
		elseif args == "m" then
			declension = declension .. "mixed declension ]"
		else
			--error("non-existent declension")
		end
		declension = declension .. ")</i></small>"
	end
	
	local data = {lang = lang, sc = sc, heads = {args or ""}, genders = nil, inflections = inflections, pos_category = "főnevek", categories = categories, sort_key = nil}
	return require("Module:headword").full_headword(data) .. declension
end


function export.verb(frame)
	params = {list = true}
	params = {list = true}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	
	local inflections = {}
	local categories = categorize(args)
	
	local sc = get_script(args)
	
	otherscript(inflections, args, sc, categories)
	
	if #args > 0 then
		causatives = {label = "causative"}
		for i, x in ipairs(args) do
			table.insert(causatives, x)
		end
		table.insert(inflections, causatives)
	end
	
	if #args > 0 then
		passives = {label = "passive"}
		for i, x in ipairs(args) do
			table.insert(passives, x)
		end
		table.insert(inflections, passives)
	end

	local data = {lang = lang, sc = sc, heads = {args or ""}, genders = nil, inflections = inflections, pos_category = "verbs", categories = categories, sort_key = nil}
	return require("Module:headword").full_headword(data)
end


return export