Module:User:DanishtD/Sandbox

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


local m_gen_num = require("Module:gender and number")
local m_links = require("Module:links")
local m_utilities = require("Module:utilities")

local m_infl =  require("Module:User:DanishtD/Sandbox/data")

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

local export = {}

-- Shows forms with links, or a dash if empty
local function show_form(subforms)
	if not subforms then
		return "—"
	elseif type(subforms) ~= "table" then
		error("a non-table value was given in the list of inflected forms.")
	elseif #subforms == 0 then
		return "—"
	end
	
	local ret = {}
	
	-- Go over each subform and insert links
	for key, subform in ipairs(subforms) do
		table.insert(ret, m_links.full_link({lang = lang, term = subform}))
	end
	
	return table.concat(ret, ", ")
end

-- Shows the table with the given forms
local function make_table(data)
	local ret = {[=[<div class="NavFrame" style="width:450px">
<div class="NavHead" style="" >] of ]=]}
	table.insert(ret, m_links.full_link({lang = lang, alt = data.forms.nom_sg}, "term") .. "&nbsp;(Viitso type\n")
	table.insert(ret, show_form({data.infl_type}) .. ")</div>\n")
	table.insert(ret, [=[<div class="NavContent">
{| border="1px solid #000000" style="border-collapse:collapse; background:#F9F9F9; text-align:center; width:100%" class="inflection-table"
|-
! style="width:158px;background:#DEDEDE" | 
! style="background:#DEDEDE" | singular <small>(])</small>
! style="background:#DEDEDE" | plural <small>(])</small>
|-
! style="background:#EFEFEF" | nominative <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.nom_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.nom_pl) .. "\n")
	table.insert(ret, [=[
|-
! style="background:#EFEFEF" | genitive <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.gen_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.gen_pl) .. "\n")
	table.insert(ret, [=[
|-
! style="background:#EFEFEF" | partitive <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.par_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.par_pl) .. "\n")
	table.insert(ret, [=[
|-
! style="background:#EFEFEF" | dative <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.dat_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.dat_pl) .. "\n")
	table.insert(ret, [=[
|-
! style="background:#EFEFEF" | instrumental <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.ins_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.ins_pl) .. "\n")
	table.insert(ret, [=[
|-
! style="background:#EFEFEF" | illative <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.ill_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.ill_pl) .. "\n")
	table.insert(ret, [=[
|-
! style="background:#EFEFEF" | inessive <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.ine_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.ine_pl) .. "\n")
	table.insert(ret, [=[
|-
! style="background:#EFEFEF" | elative <small>(])</small>
]=])
	table.insert(ret, "| " .. show_form(data.forms.ela_sg) .. "\n")
	table.insert(ret, "| " .. show_form(data.forms.ela_pl) .. "\n")
	table.insert(ret, [=[
|-
|}</div></div>]=])

	return table.concat(ret)
end

-- Main entry point
function export.show(frame)
	local args = frame:getParent().args
	
	-- Create the forms
	local data = {forms = {}, categories = {}, refl = false}
	
	-- Find what type of verb is it (hard-coded in the template).
	-- m_gen_numerate standard conjugated forms for each type of verb,
	local infl_type = frame.args
	
	if not args then args = "{{{1}}}" end
	--[[ Provisional code to prevent arg 2 from being blank, to avoid
		the following forms from ending up as blank stems with their
		inflectional endings
	]]--
	if (args == "" or not args) then args = args end
	
	if not infl_type then
		data.forms.nom_sg = {args}; if data.forms.nom_sg == "" then data.forms.nom_sg = nil end
	elseif m_infl then
		m_infl(args, data)
	else
		error("Noun type " .. infl_type .. " not supported.")
	end
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

return export