Module:Dsb-headword

local m_headword = require("Module:headword")
local m_utilities = require("Module:utilities")

local export = {}
local pos_functions = {}

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local args = frame:getParent().args
	PAGENAME = mw.title.getCurrentTitle().text
	
	local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	
	local genders = {}
	local inflections = {}
	local categories = {"Lower Sorbian " .. poscat}
	
	local head = args["head"]; if head == "" then head = nil end
	
	-- See if a function exists for the particular part-of-speech type, and call it if there is one.
	if pos_functions[poscat] then
		pos_functions[poscat](args, genders, inflections, categories)
	end
	
	return
		m_headword.format_headword(head, "dsb", "Latn") ..
		m_headword.format_genders(genders, "dsb") ..
		m_headword.format_inflections(inflections, "dsb", "Latn") ..
		m_utilities.format_categories(categories, "dsb")
end

pos_functions["nouns"] = function(args, genders, inflections, categories)
	-- Gender
	local g = args[1]; if g == "" then g = nil end
	table.insert(genders, g)
	
	if g == "m" then
		table.insert(categories, "Lower Sorbian masculine nouns")
	elseif g == "f" then
		table.insert(categories, "Lower Sorbian feminine nouns")
	elseif g == "n" then
		table.insert(categories, "Lower Sorbian neuter nouns")
	elseif g == "p" then
		table.insert(categories, "Lower Sorbian pluralia tantum")
	end
	
	-- Genitive
	local gen = args["gen"]; if gen == "" then gen = nil end
	
	if gen then
		table.insert(inflections, {"genitive", gen})
	end
	
	if g == "p" then
		table.insert(inflections, {"plurale tantum"})
	else
		-- Dual
		local dual = args["dual"]; if dual == "" then dual = nil end
		
		if dual then
			table.insert(inflections, {"dual", dual})
		end
		
		-- Plural
		local pl = args["pl"]; if pl == "" then pl = nil end
		
		if pl then
			table.insert(inflections, {"plural", pl})
		end
	end
	
	-- Diminutive
	local dim = args["dim"]; if dim == "" then dim = nil end
	
	if dim then
		table.insert(inflections, {"diminutive", dim})
	end
	
	-- Feminine
	local f = args["f"]; if f == "" then f = nil end
	
	if f then
		table.insert(inflections, {"feminine equivalent", f})
	end
	
	-- Masculine
	local m = args["m"]; if m == "" then m = nil end
	
	if m then
		table.insert(inflections, {"masculine equivalent", m})
	end
end

return export

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.