Module:rsk-verb

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


--[=[
    This module contains functions for creating inflection tables for Pannonian Rusyn
    verbs. Based on Module:sk-verb.
]=]--

local export = {}

-- Within this module, conjugations are the functions that do the actual
-- conjugating by creating the forms of a basic verb.
-- They are defined further down.
local conjugations = {}
local lang = require("Module:languages").getByCode("rsk")
local m_links = require("Module:links")

-- 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
    NAMESPACE = mw.title.getCurrentTitle().nsText
    if NAMESPACE == "" then
    	PAGENAME = mw.title.getCurrentTitle().text
    else
    	if args then
    		PAGENAME = args
    	else
    		error("Pagename not specified")
    	end
    end
 
    -- Default to impf on the template page so that there is no script error.
    local verb_type = args or (NAMESPACE == "Template" and "impf") or error("Verb type has not been specified. Please pass parameter 1")
    local conj_type = args or error("Conjugation type has not been specified. Please pass parameter 2")
    
    --reflexive
    local refl = false
    if mw.ustring.find(verb_type, "se") then
    	refl = true
    	PAGENAME = PAGENAME .. " ше"
    elseif mw.ustring.find(PAGENAME, " ше$") then
    	refl = true
    end
    --perfective
    --TODO: biasp
    local perf = false
    if not mw.ustring.find(verb_type, "impf") then perf = true end
    --impersonal
    local impers = false
    if mw.ustring.find(verb_type, "impers") then impers = true end
    
    local cats = {
    	refl = refl,
    	perf = perf,
    	impers = impers
    }
    
    PERF_FULL = "perfective"
    if not perf then PERF_FULL = "imperfective" end 
    
    IMPERS = ""
    if impers then IMPERS = "impersonal; " end
    
    local forms, title, categories
 
    if conjugations then
        forms, title, categories = conjugations(args)
    else
        error("Unknown conjugation type '" .. conj_type .. "'")
    end
 
	
    --alternative forms
    --forms = args
    --forms = args
    --forms = args
    forms = args
    forms = args
    forms = args
    forms = args
    --forms = args
    --forms = args
    --forms = args
    --forms = args
    forms = args
    forms = args
    forms = args
    forms = args
    forms = args
    forms = args
    
    if args then forms = args end
    if args then forms = args end
    
    --parameters passed by the user
    local no_impr = args
    local no_pres_actv_part = args
    local no_pasv_part = args
    local no_gerund = args
    local pres_actv_part = args
    local pasv_part = args
    local impf_part = args
    local short = args
    local dt = args
    
    local params = {
    	no_impr = no_impr,
    	no_pres_actv_part = no_pres_actv_part,
    	no_pasv_part = no_pasv_part,
    	no_gerund = no_gerund,
    	pres_actv_part = pres_actv_part,
    	pasv_part = pasv_part,
    	impf_part = impf_part,
    	short = short,
    	dt = dt
    }
 
    -- Perfective/imperfective
    table.insert(categories, "Pannonian Rusyn " .. PERF_FULL .. " verbs")
 
    -- Reflexive
    if refl then
        make_reflexive(forms)
        table.insert(categories, "Pannonian Rusyn reflexive verbs")
    end
 
    local ret = ""
 
    if NAMESPACE == "" then
        local sort_key = PAGENAME
        for key, cat in ipairs(categories) do
            ret = ret .. "]"
        end
    end
 
    return make_table(forms, title, cats, params) .. ret
end

--[=[
    Conjugation functions
]=]--

-- pattern чит-а-м, чит-ай-у, чит-а-ц
conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 1 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 1, pattern ''читац'')"
    
    local stem = ""
    if mw.ustring.find(PAGENAME, "ац$") or mw.ustring.find(PAGENAME, "ац ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "ац")
    elseif mw.ustring.find(PAGENAME, "яц$") or mw.ustring.find(PAGENAME, "яц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "яц")
    end
    
    local pres_stem1 = stem .. "а"
    local pres_stem2 = stem .. "ай"
    local inf_stem = stem .. "а"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
    
    return forms, title, categories
end

-- pattern видз-и-м, видз--а, видз-и-ц
conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 2 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 2a, pattern ''видзиц'')"
    
    local stem = ""
    if mw.ustring.find(PAGENAME, "иц$") or mw.ustring.find(PAGENAME, "иц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "иц")
    elseif mw.ustring.find(PAGENAME, "їц$") or mw.ustring.find(PAGENAME, "їц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "їц")
    end
    
    local pres_stem1 = stem .. "и"
    local pres_stem2 = stem
    local inf_stem = stem .. "е"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "а")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
    
    return forms, title, categories
end

-- pattern роб-и-м, роб-й-а, роб-и-ц
conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 2 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 2b, pattern ''робиц'')"
    
    local stem = ""
    if mw.ustring.find(PAGENAME, "иц$") or mw.ustring.find(PAGENAME, "иц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "иц")
    elseif mw.ustring.find(PAGENAME, "їц$") or mw.ustring.find(PAGENAME, "їц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "їц")
    end
    
    local pres_stem1 = stem .. "и"
    local pres_stem2 = stem .. "й"
    local inf_stem = stem .. "е"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "а")
    add_imperative_suffixes(forms, stem)
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
    
    return forms, title, categories
end

--TODO: figure out -nul, -ol paradigm 
conjugations = function(params)
    local forms = {}
    local categories = {"Pannonian Rusyn class 3 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 3a, pattern ''спаднуц'')"
    
    local stem = remove_reflexive_particle_and_suffix(PAGENAME, "ц")
    stem = remove_reflexive_particle_and_suffix(stem, get_last_char(stem))
    
    local last = mw.ustring.sub(stem, -2, -1)
    local soft_stem = ""
    if last == "сн" then
    	soft_stem = remove_suffix(stem, "сн")
    	soft_stem = soft_stem .. "шн"
    elseif last == "зн" then
    	soft_stem = remove_suffix(stem, "зн")
    	soft_stem = soft_stem .. "жн"
    else 
    	soft_stem = stem
    end

    local pres_stem1 = soft_stem .. "є"
    local pres_stem2 = soft_stem .. "ь"
    local inf_stem = stem .. "у"
    local inf_stem2 = remove_suffix(stem, "н")
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "ц")
    
    if params then
	    add_preterite_suffixes(forms, inf_stem, inf_stem2)
	else 
		add_preterite_suffixes(forms, inf_stem, nil)
	end
 
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 3 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 3b, pattern ''гинуц'')"
    
    local stem = remove_reflexive_particle_and_suffix(PAGENAME, "ц")
    stem = remove_reflexive_particle_and_suffix(stem, get_last_char(stem))

    local pres_stem1 = stem .. "є"
    local pres_stem2 = stem .. "ь"
    local inf_stem = stem .. "у"
    local inf_stem2 = remove_suffix(stem, "н")
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "ц")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 4 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 4, pattern ''куповац'')"
    
    local stem = remove_reflexive_particle_and_suffix(PAGENAME, "овац")

    local pres_stem1 = stem .. "ує"
    local pres_stem2 = stem .. "уй"
    local inf_stem = stem .. "ова"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end
 
conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 5 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 5, pattern ''червенїц'')"
    
    local stem = ""
    if mw.ustring.find(PAGENAME, "иц$") or mw.ustring.find(PAGENAME, "иц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "иц")
    elseif mw.ustring.find(PAGENAME, "їц$") or mw.ustring.find(PAGENAME, "їц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "їц")
    end

    local pres_stem1 = stem .. "еє"
    local pres_stem2 = stem .. "ей"
    local inf_stem = stem .. "е"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

-- pattern нє-ше-м, нє-ш-у, нє-с-ц
conjugations = function(params)
    local forms = {}
    local categories = {"Pannonian Rusyn class 6 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 6a, pattern ''нєсц'')"
    
    local stem = remove_reflexive_particle_and_suffix(PAGENAME, "ц")

    local stem_last = get_last_char(stem) -- s or z
    local pres_stem_last = ""
    if stem_last == "с" then
    	pres_stem_last = "ш"
    elseif stem_last == "з" then
    	pres_stem_last = "ж"
    end

    local pres_stem1 = remove_last_char(stem) .. pres_stem_last .. "е"
    local pres_stem2 = remove_last_char(pres_stem1)
    local inf_stem = stem
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, nil, pres_stem1, "н")
    
    if params then
    	add_preterite_suffixes(forms, inf_stem, inf_stem)
    else 
    	add_preterite_suffixes(forms, inf_stem, "o")
    end
    
    return forms, title, categories
end

-- pattern ве-дзе-м, ве-д-у, ве-с-ц
conjugations = function(params)
 
    local forms = {}
    local categories = {"Pannonian Rusyn class 6 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 6b, pattern ''весц'')"
	
	local stem = remove_reflexive_particle_and_suffix(PAGENAME, "сц")
    
    local dt = ""
    local past_stem = ""
    
    if get_last_char(stem) == "и" then
    	dt = "d"
    	past_stem = stem .. "ш"
    elseif get_last_char(stem) == "й" then
    	dt = "d"
    	past_stem = remove_last_char(stem) .. "ш"
    else
    	dt = params or error("The conjugation root (\"d\" or \"t\") has not been specified. Please pass parameter 3")
    end
    
	local dt_cyrillic = ""
	local dt_soft = ""
	
	if dt == "d" then
		dt_cyrillic = "д"
		dt_soft = "дз"
	elseif dt == "t" then
		dt_cyrillic = "т"
		dt_soft = "ц"
	end
	
    local pres_stem1 = stem .. dt_soft .. "е"
    local pres_stem2 = stem .. dt_cyrillic
    local inf_stem = stem .. dt_soft
    
    if past_stem == "" then past_stem = pres_stem2 end
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, inf_stem)
    set_participles_etc(forms, nil, pres_stem1, "н")
    
    if params then
    	add_preterite_suffixes(forms, past_stem, past_stem)
    else 
    	add_preterite_suffixes(forms, past_stem, "o")
    end
    
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 7 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 7a, pattern ''орац'')"
    
    if mw.ustring.find(PAGENAME, "ац$") or mw.ustring.find(PAGENAME, "ац ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "ац")
    elseif mw.ustring.find(PAGENAME, "яц$") or mw.ustring.find(PAGENAME, "яц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "яц")
    end
    
    local stem2 = nil
    if mw.ustring.find(stem, "бр$") then
        stem2 = remove_last_char(stem) .. "e" .. get_last_char(stem)
    elseif mw.ustring.find(stem, "кл$") then
        stem2 = remove_last_char(stem) .. "о" .. get_last_char(stem) .. "ь"
    elseif mw.ustring.find(stem, "гн$") then
        stem2 = "жень"
    else
        stem2 = stem
    end
    local pres_stem1 = stem2 .. "е"
    local pres_stem2 = stem2
    local inf_stem = stem .. "а"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 7 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 7b, pattern ''писац'')"
    
    local stem = ""
    local stem2 = nil
    
    stem = remove_reflexive_particle_and_suffix(PAGENAME, "ац")
    if get_last_char(stem) == "с" or get_last_char(stem) == "х" then
    	stem2 = remove_last_char(stem) .. "ш"
    elseif get_last_char(stem) == "з" then
    	stem2 = remove_last_char(stem) .. "ж"
    elseif get_last_char(stem) == "к" then
    	stem2 = remove_last_char(stem) .. "ч"
    end
    
    local pres_stem1 = stem2 .. "е"
    local pres_stem2 = stem2
    local inf_stem = stem .. "а"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
    
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 8 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 8, pattern ''клєчац'')"
    
    local stem = ""
    if mw.ustring.find(PAGENAME, "ац$") or mw.ustring.find(PAGENAME, "ац ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "ац")
    elseif mw.ustring.find(PAGENAME, "яц$") or mw.ustring.find(PAGENAME, "яц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "яц")
    end
    
    local stem2 = ""
    if mw.ustring.find(stem, "сп$") then
    	if mw.ustring.len(stem) > 2 then
    		stem2 = mw.ustring.sub(stem, 1, -3) .. "шп"
    		pres_stem2_2 = mw.ustring.sub(stem, 1, -3) .. "шпй"
    	else 
    		stem2 = "шп"
    		pres_stem2_2 = "шпй"
    	end
    else 
    	stem2 = stem
    	pres_stem2_2 = stem
    end
    
    local pres_stem1 = stem2 .. "и"
    local pres_stem2 = pres_stem2_2
    local inf_stem = stem .. "а"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "а")
    
    if mw.ustring.find(stem, "сп$") then
    	add_imperative_suffixes(forms, pres_stem1)
    else 
    	add_imperative_suffixes(forms, pres_stem2)
    end
    
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, inf_stem, nil)
    
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 9 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 9, pattern ''жиц'')"
    
    stem = remove_reflexive_particle_and_suffix(PAGENAME, "ц")
    
    local pres_stem1 = stem .. "є"
    local pres_stem2 = stem .. "й"
    local inf_stem = stem
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "т")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 10 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 10, pattern ''шмец'')"
    
    if mw.ustring.find(PAGENAME, "ец$") or mw.ustring.find(PAGENAME, "ец ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "ец")
    elseif mw.ustring.find(PAGENAME, "єц$") or mw.ustring.find(PAGENAME, "єц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "єц")
    end
    
    local stem2 = nil
    local past_stem = ""
    if mw.ustring.find(stem, "мль$") then
        stem2 = "мель"
        past_stem = stem .. "е"
    elseif mw.ustring.find(stem, "р$") then
    	stem2 = stem
        past_stem = remove_last_char(stem) .. "а" .. get_last_char(stem)
    else
        stem2 = stem
        past_stem = stem .. "е"
    end
    
    local pres_stem1 = stem2 .. "е"
    local pres_stem2 = stem2
    local inf_stem = stem .. "е"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2 .. "и")
    set_participles_etc(forms, inf_stem, inf_stem, "н")
    add_preterite_suffixes(forms, past_stem, "no_l")
 
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 11 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 11, pattern ''кляц'')"
    
    if mw.ustring.find(PAGENAME, "ац$") or mw.ustring.find(PAGENAME, "ац ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "ац")
    elseif mw.ustring.find(PAGENAME, "яц$") or mw.ustring.find(PAGENAME, "яц ше$") then
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "яц")
    end
    
    local pres_stem1 = stem .. "еє"
    local pres_stem2 = stem .. "ей"
    local inf_stem = stem .. "а"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "т")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 12 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 12, pattern ''жац'')"
    
    local stem = remove_reflexive_particle_and_suffix(PAGENAME, "ац")

    local stem2 = stem
    local stem_last = get_last_char(stem)
    if stem_last == "ц" then
    	stem2 = remove_last_char(stem) .. "т"
    elseif mw.ustring.find(stem, "ст$") then
        stem2 = stem .. "а"
    elseif mw.ustring.find(stem, "вж$") then
        stem2 = "веж"
    end

    local pres_stem1 = stem2 .. "нє"
    local pres_stem2 = stem2 .. "нь"
    local inf_stem = stem .. "а"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "т")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

conjugations = function()
    local forms = {}
    local categories = {"Pannonian Rusyn class 13 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 13, pattern ''бац'')"
    
    local stem = remove_reflexive_particle_and_suffix(PAGENAME, "ац")

    local stem2 = stem .. "ой"

    local pres_stem1 = stem2 .. "и"
    local pres_stem2 = stem2
    local inf_stem = stem .. "а"
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "а")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, inf_stem, "т")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

conjugations = function(params)
    local forms = {}
    local categories = {"Pannonian Rusyn class 14 verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (" .. PERF_FULL .. "; " .. IMPERS .. "class 14, pattern ''печиц'')"
    
    local stem = ""
    if mw.ustring.find(PAGENAME, "мочи$") then
    	stem = remove_suffix(PAGENAME, "чи") .. "ж"
    else 
    	stem = remove_reflexive_particle_and_suffix(PAGENAME, "иц")
    end

	local stem2 = ""
	if get_last_char(stem) == "ч" then
    	stem2 = remove_last_char(stem) .. "к"
	elseif get_last_char(stem) == "ж" then
		stem2 = remove_last_char(stem) .. "г"
	end

    local pres_stem1 = stem .. "е"
    local pres_stem2 = stem
    local inf_stem = stem2
    
    forms = PAGENAME
    
    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2)
    set_participles_etc(forms, inf_stem, pres_stem1, "н")
    
    if mw.ustring.find(PAGENAME, "мочи$") then
    	params = 1
    	forms = ""
    	forms = ""
    	forms = ""
    end
    
    if params or mw.ustring.find(PAGENAME, "мочи$") then
	    add_preterite_suffixes(forms, inf_stem, inf_stem)
	else 
		add_preterite_suffixes(forms, inf_stem, "o")
	end
 
    return forms, title, categories
end

conjugations = function()
    -- irregular, only for verbs derived from буц derivatives
    local forms = {}
    local categories = {"Pannonian Rusyn irregular verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (irregular)"
 
    local prefix = remove_suffix(remove_reflexive_particle_and_suffix(PAGENAME, ""), "буц")
 
    forms = PAGENAME

    add_imperative_suffixes(forms, prefix .. "будз")
    if prefix == "" then
    	forms = "]"
	    forms = "]"
	    forms = "]"
	    forms = "]"
	    forms = "]"
	    forms = "]"
    	forms = ""
    	forms = ""
    	forms = ""
    else 
    	local pres_stem1 = prefix .. "будзе"
	    local pres_stem2 = prefix .. "буд"
	
    	add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    	set_participles_etc(forms, prefix .. "бу", prefix .. "бу", "т")
    end
    
    add_preterite_suffixes(forms, prefix .. "бу", nil)
 
    return forms, title, categories
end

conjugations = function()
    -- irregular, only for verbs derived from єсц
    local forms = {}
    local categories = {"Pannonian Rusyn irregular verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (irregular)"
 
    local prefix = ""
    if mw.ustring.find(PAGENAME, "есц$") then -- pretty much just жесц
    	prefix = remove_suffix(PAGENAME, "есц")
    else 
    	prefix = remove_suffix(PAGENAME, "єсц") .. "й"
    end
 
    forms = PAGENAME

    add_present_suffixes(forms, prefix .. "е", prefix .. "едз", "а")
    add_imperative_suffixes(forms, prefix .. "едз")
    set_participles_etc(forms, nil, prefix .. "едз", "ен")
    forms = ""
    add_preterite_suffixes(forms, prefix .. "ед", "o")
 
    return forms, title, categories
end

conjugations = function()
    -- irregular, only for verbs derived from прияц
    local forms = {}
    local categories = {"Pannonian Rusyn irregular verbs"}
    local title = "Conjugation of ''" .. PAGENAME .. "'' (irregular)"
 
    local stem = remove_suffix(PAGENAME, "ц")
    local stem2 = remove_suffix(PAGENAME, "яц")

    local pres_stem1 = stem2 .. "ме"
    local pres_stem2 = stem2 .. "м"
    local inf_stem = stem
    
    forms = PAGENAME

    add_present_suffixes(forms, pres_stem1, pres_stem2, "у")
    add_imperative_suffixes(forms, pres_stem2 .. "и")
    set_participles_etc(forms, inf_stem, inf_stem, "т")
    add_preterite_suffixes(forms, inf_stem, nil)
 
    return forms, title, categories
end

--[=[
    Partial conjugation functions
]=]--

function get_last_char(str)
    local last = mw.ustring.sub(str, -1, -1)
    return last
end

function remove_last_char(str)
    local stem = mw.ustring.sub(str, 1, -2)
    return stem
end

function ends_with_2_consonants(str)
    local cond = false

    if mw.ustring.find(str, "$") and not mw.ustring.find(str, "д$") then
        cond = true
    end

    return cond
end

function ends_with_3_consonants(str)
    local cond = false

    if mw.ustring.find(str, "$") and not mw.ustring.find(str, "д$") then
        cond = true
    end

    return cond
end

function remove_suffix(form, suffix)
    local base = form

    if mw.ustring.find(base, suffix .. "$") then
        local length = mw.ustring.len(suffix)
        base = mw.ustring.sub(base, 1, -length-1)
    end

    return base
end

function remove_reflexive_particle_and_suffix(inf, suffix)

    local stem = null
    if mw.ustring.find(inf, " ше$") then
    	stem = remove_suffix(inf, suffix .. " ше")
    else 
    	stem = remove_suffix(inf, suffix)
    end
    if suffix == "яц" or suffix == "їц" then
    	if (mw.ustring.find(stem, "$")) then
    		stem = stem .. "й"
    	else 
    		stem = stem .. "ь"
    	end
    end

    return stem
end

-- TODO: rename this
function repl_dtnl_ei(str)

    local new_string = str
    
    new_string = mw.ustring.gsub(new_string, "йу", "ю")
    new_string = mw.ustring.gsub(new_string, "йа", "я")
    new_string = mw.ustring.gsub(new_string, "йе", "є")
    new_string = mw.ustring.gsub(new_string, "йи", "ї")
    new_string = mw.ustring.gsub(new_string, "ьу", "ю")
    new_string = mw.ustring.gsub(new_string, "ьа", "я")
    new_string = mw.ustring.gsub(new_string, "ье", "є")
    new_string = mw.ustring.gsub(new_string, "ьи", "ї")

    return new_string
end

function add_present_suffixes(forms, stem1, stem2, stem2suffix)

    local suffix2 = stem2suffix
    
    local stem1_dtnl = repl_dtnl_ei(stem1)
 
    forms = stem1_dtnl .. "м"
    forms = stem1_dtnl .. "ш"
    forms = stem1_dtnl
    forms = stem1_dtnl .. "ме"
    forms = stem1_dtnl .. "це"
    forms = repl_dtnl_ei(stem2 .. suffix2)
end

function add_imperative_suffixes(forms, stem)
    local st = stem
    local st2 = ""
    local extra_i = ""
    if ends_with_3_consonants(st) then
        extra_i = "и"
    elseif ends_with_2_consonants(st) and not mw.ustring.find(mw.ustring.sub(st, -2, -1), "ь") then
    	extra_i = "и"
    end
    
    if  mw.ustring.sub(stem, -4, -1) == "патр" then
    	st2 = mw.ustring.gsub(stem, "патр", "пать")
    end
    forms = repl_dtnl_ei(st .. extra_i)
    forms = repl_dtnl_ei(st .. extra_i .. "ме")
    forms = repl_dtnl_ei(st .. extra_i .. "це")
    
    if st2 ~= "" then
    	forms = repl_dtnl_ei(st2)
    	forms = repl_dtnl_ei(st2 .. "ме")
    	forms = repl_dtnl_ei(st2 .. "це")
    end
end

function add_preterite_suffixes(forms, stem, stem2)
    local extra_o = ""
    if stem == stem2 or stem2 == "o" then
        extra_o = "о"
    end
    
    local short_stem = ""
    if mw.ustring.find(stem, "ну$") and ends_with_2_consonants(remove_last_char(stem)) then
    	short_stem = remove_suffix(stem, "ну")
    else
    	short_stem = stem
    end
    
    if stem2 == "no_l" then 
    	 forms = repl_dtnl_ei(stem)
    else
    	forms = repl_dtnl_ei(stem .. extra_o .. "л")
    	if mw.ustring.find(stem, "ну$") and stem2 == nil then
    		forms = repl_dtnl_ei(short_stem .. "ол")
    	end
    end
    forms = repl_dtnl_ei(short_stem .. "ла")
    forms = repl_dtnl_ei(short_stem .. "ло")
    forms = repl_dtnl_ei(short_stem .. "ли")
    
    if stem2 ~= nil and stem2 ~= "o" and stem2 ~= "no_l" then
	    forms = repl_dtnl_ei(stem2)
	    if stem2 ~= stem then
	    	forms = repl_dtnl_ei(stem2 .. "ла")
	    	forms = repl_dtnl_ei(stem2 .. "ло")
	    	forms = repl_dtnl_ei(stem2 .. "ли") 
	    end
	end
end

function set_participles_etc(forms, stem1, stem2, pas_part_suffix)
    forms = forms .. "ци"
    if stem1 == nil then
        forms = ""
    else
        forms = repl_dtnl_ei(stem1 .. "вши")
    end
    
    forms = repl_dtnl_ei(stem2 .. pas_part_suffix .. "и")
    
    if mw.ustring.find(pas_part_suffix, "н$") or mw.ustring.find(pas_part_suffix, "л$") then
    	forms = repl_dtnl_ei(stem2 .. pas_part_suffix .. "є")
    elseif pas_part_suffix == "т" then
    	forms = repl_dtnl_ei(stem2 .. "це")
    else
    	forms = repl_dtnl_ei(stem2 .. pas_part_suffix .. "е")
    end 
end

function create_composite(form, inf, tense, mood, person, gender, subject)
	
	subject = subject or false
	gender = gender or "p"

    local buc_pres = {" ]", " ]", "", " ]", " ]", ""}
    local bul_gend = {m="]", f="]", n="]", p="]"}
    local bude = {"]", "]", "]", "]", "]", "]"}
    local bude_nl = {"]", "]", "]", "]", "]", "]"}
    local by = {" ]", " ]", " ]", " ]", " ]", " ]"}
    
    local refl = ""
    if mw.ustring.find(inf, " ше$") then refl = " ше" end
    local refl_space = refl .. " "
    
    if person > 3 then gender = "p" end
    
    
    local accel_form = ""
    if tense == "past" and mood == "ind" and person % 3 == 0 then
    	if person == 3 then
    		accel_form = gender .. "|3|s|past|ind"
    	elseif person == 6 then
    		accel_form = "3|p|past|ind"
    	end
    elseif gender == "p" then
    	accel_form = "p|l-ptcp"
    else
    	accel_form = gender .. "|s|l-ptcp"
    end
    
    if tense ~= "fut" then form = make_link(form, accel_form) end

    local result = nil
    if tense == "past" then
        if mood == "ind" then
            result = form .. buc_pres .. refl
        elseif mood == "cond" then
        	if subject then
        		result = by .. " " .. bul_gend .. refl_space .. form 
        	else 
        		result = bul_gend .. by .. refl_space .. form 
            end
            if gender ~= "p" and person ~= 3 then
            	result = result .. ", " .. bul_gend .. by .. buc_pres .. refl_space .. form
            end
            -- result = bul_gend .. by .. buc_pres .. refl_space .. form
        end
    elseif tense == "past perfect" and mood == "ind" then
        result = bul_gend .. buc_pres .. refl_space .. form
    elseif tense == "present" and mood == "cond" then
    	if subject then
        	result =  by .. " " .. form .. refl
        else
        	result = form .. by .. refl
    	end 
        if gender ~= "p" and person ~= 3 then
        	result = result .. ", " .. form .. by .. buc_pres .. refl
        end
        -- result = form .. by .. buc_pres .. refl
    elseif subject and person == 3 then
    	result = "—"
    elseif tense == "fut" then
    	if inf == "буц" and not subject then
    		result = make_link(bude_nl, (((person - 1) % 3) + 1) .. "|" .. ((person <= 3) and "s" or "p") .. "|fut|ind")
    	elseif subject and gender == "p" then
    		result =  "&mdash;"
    	else
        	result = bude .. refl_space .. remove_suffix(inf, refl)
        end
    end

    return result
end
 
 
-- Add the reflexive particle to all verb forms
function make_reflexive(forms)
    for key, form in pairs(forms) do
        if form ~= "" and not mw.ustring.find(form, " ше$") and not mw.ustring.find(key, "past_") and not mw.ustring.find(key, "pres_pasv_part") then
            forms = form .. " ше"
        end
    end
end

function make_link(link, accel_form)
    local new_link = link

    -- Check if the link ends with " ше"
    local ending = ""
	if mw.ustring.find(link, " ше$") then ending = "ше" end

    if #ending > 0 then
        -- Remove the ending from the link
        link = remove_suffix(link, " " .. ending)
    end

    -- If link is not empty, valid, and not "&mdash;", create the full link
    if link ~= "" and link and link ~= "&mdash;" then
        new_link = m_links.full_link({lang = lang, term = link, accel = {form = accel_form}})
    end
    
    if #ending > 0 then
        new_link = new_link .. " " .. ending
    end

    return new_link
end

function convert_to_accel(input)
    -- Define mappings for person, number, tense, mood, and other specific cases
    local mood_map = {
        pres = "ind",
        futr = "ind",
        impr = "imp"
    }
    
    local tense_map = {
        pres = "pres",
        futr = "fut",
        impr = "pres"  -- For imperative, tense is always present
    }

    -- Handle special cases
    local special_cases = {
         = "pres|act|part",
         = "past|act|part",  -- Assuming 'past' is passive
         = "pasv|part",
         = "m|s|l-ptcp",
         = "vnoun"
    }

    -- Check if the input matches any special case
    if special_cases then
        return special_cases
    end

    -- Otherwise, proceed with regular tense/mood parsing
    local tense_mood, person_number = input:match("(+)_(++)")

    -- Extract person and number
    local person = person_number:match("()")
    local number = person_number:match("()")

    -- Convert tense/mood
    local tense = tense_map
    local mood = mood_map

    -- Format the result as "person|number|(tense)|mood"
    if tense_mood == "impr" then
    	return string.format("%s|%s|%s", person, number, mood)
    else
    	return string.format("%s|%s|%s|%s", person, number, tense, mood)
    end
end

function check_add_alt(forms, id, impers)
	local accel_form = convert_to_accel(id)
    local result = make_link(forms, accel_form)
    if id == "past_m" and impers then
    	result = make_link(forms)
    	if forms then result = result .. ",<br />" .. make_link(forms, accel_form) end
    elseif id == "past_m" then
    	result = make_link(forms, accel_form) .. ", "
    	.. make_link(forms, "f|s|l-ptcp") .. ", "
    	.. make_link(forms, "n|s|l-ptcp") .. ", "
    	.. make_link(forms, "p|l-ptcp")
    	if forms and forms and forms and forms then
    		result = result .. "<br />" .. make_link(forms, accel_form) .. ", "
    		.. make_link(forms, "f|s|l-ptcp") .. ", "
    		.. make_link(forms, "n|s|l-ptcp") .. ", "
    		.. make_link(forms, "p|l-ptcp")
    	end
    elseif impers == "subject" then
    	result = "&mdash;"
    else
    	if forms then result = result .. ",<br />" .. make_link(forms, accel_form) end
    end

    return result
end

function check_add_alt_comp(forms, tense, mood, gender, person, subject)
    local result = ""
    result = create_composite(forms, forms, tense, mood, person, gender, subject)
    if forms then
        result = result .. ",<br />" .. create_composite(forms, forms, tense, mood, person, gender)
    end

    return result
end

function make_table_header(title)
    local header = [=[<div class="NavFrame">
    <div class="NavHead">]=] .. title .. [=[</div>
    <div class="NavContent">
    <table style="text-align:center; width:100%" class="inflection-table">]=]

    return header
end

function make_simple_row(label, form)
    local row = [=[<tr style="height:2em;">
        <th colspan="3" style="background:#d0d0d0;">]=] .. label .. [=[</th>
        <td colspan="5"><span lang=\"rsk\">''']=] .. form .. [=['''</span></td>
    </tr>]=]

    return row
end

function make_mood_header(mood, colour)
    local header = [=[<tr>
    <th colspan="2" rowspan="2" style="background:]=] .. colour .. =] .. mood .. [=[</th>
    <th colspan="4" style="background:]=] .. colour .. [=[">''singular''</th>
    <th colspan="4" style="background:]=] .. colour .. [=[">''plural''</th>
    </tr>
    <tr>
    <th style="background:]=] .. colour .. ]</th>
    <th style="background:]=] .. colour .. ]</th>
    <th style="background:]=] .. colour .. ]</th>
    <th style="background:]=] .. colour .. [=[">subject</th>
    <th style="background:]=] .. colour .. ]</th>
    <th style="background:]=] .. colour .. ]</th>
    <th style="background:]=] .. colour .. ]</th>
    <th style="background:]=] .. colour .. [=[">subject</th>
    </tr>]=]

    return header
end

function make_indecl_header(colour)
    local header = [=[<tr>
    <th colspan="2" rowspan="3" style="background:]=] .. colour .. [=[">non-finite forms</th>
    <th colspan="7" style="background:]=] .. colour .. [=[">participles</th>
    <th rowspan="2" style="background:]=] .. colour .. [=[">verbal noun</th>
    </tr>
    <tr>
    <th style="background:]=] .. colour .. [=[">present active</th>
    <th style="background:]=] .. colour .. [=[">past active</th>
    <th style="background:]=] .. colour .. [=[">passive</th>
    <th colspan="4" style="background:]=] .. colour .. [=[">l-participle</th>
    </tr>]=]

    return header
end

function make_full_row(tense, colour, form1, form2, form3, form4, form5, form6, form7, form8)
	local first_col = ""
	if tense ~= "non-finite" then
    	first_col = =] .. colour .. =] .. tense .. =]
    end
    local row = =]
    .. first_col ..
    =] .. form1 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form2 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form3 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form4 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form5 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form6 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form7 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form8 .. [=[</span></td>
    </tr>]=]
    row = row .. add_row_separator()

    return row
end

function make_full_row5(tense, colour, form1, form2, form3, form4, form5)
	local first_col = ""
	if tense ~= "non-finite" then
    	first_col = =] .. colour .. =] .. tense .. =]
    end
    local row = =]
    .. first_col ..
    =] .. form1 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form2 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form3 .. [=[</span></td>
    <td colspan="4"><span lang=\"rsk\">]=] .. form4 .. [=[</span></td>
    <td><span lang=\"rsk\">]=] .. form5 .. [=[</span></td>
    </tr>]=]
    row = row .. add_row_separator()

    return row
end

function add_row_separator()
	if #IMPERS > 0 then
		return ""
	else
		return "<tr style=\"height: 0px;\"><td colspan=\"8\" style=\"height: 0px; padding: 0;\"></td></tr>"
	end
end

function make_full_row_comp(tense, colour, forms, mood, impers, subject)
	local row = ""
	
	if subject == nil then
		row = [=[<tr style="line-height: 1.2;">
	        <th rowspan="3" style="background:]=] .. colour .. =] .. tense .. [=[</th>
	        <th style="background:]=] .. colour .. [=[; width:7em; padding-bottom: 0;">masculine</th>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "m", 1) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "m", 2) .. [=[</span></td>
	        <td colspan="2"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "m", 3) .. [=[</span></td>
	        <td rowspan="3"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "pl", 4) .. [=[</span></td>
	        <td rowspan="3"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "pl", 5) .. [=[</span></td>
	        <td colspan="2" rowspan="3"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "pl", 6) .. [=[</span></td>
	    </tr>
	    <tr style="line-height: 1.2;">
	        <th style="background:]=] .. colour .. [=[; width:7em; padding-top: 0; padding-bottom: 0;"">feminine</th>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "f", 1) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "f", 2) .. [=[</span></td>
	        <td colspan="2"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "f", 3) .. [=[</span></td>
	    </tr>
	    <tr style="line-height: 1.2;">
	        <th style="background:]=] .. colour .. [=[; width:7em; padding-top: 0;">neuter</th>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "n", 1) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "n", 2) .. [=[</span></td>
	        <td colspan="2"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "n", 3) .. [=[</span></td>
	    </tr>]=]
	    row = row .. add_row_separator()
	else 
		row = [=[<tr style="line-height: 1.2;">
	        <th rowspan="3" style="background:]=] .. colour .. =] .. tense .. [=[</th>
	        <th style="background:]=] .. colour .. [=[; width:7em; padding-bottom: 0;">masculine</th>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "m", 1) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "m", 2) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "m", 3) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "m", 3, 1) .. [=[</span></td>
	        <td rowspan="3"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "pl", 4) .. [=[</span></td>
	        <td rowspan="3"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "pl", 5) .. [=[</span></td>
	        <td rowspan="3"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "pl", 6) .. [=[</span></td>
	        <td rowspan="3"><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "pl", 6, 1) .. [=[</span></td>
	    </tr>
	    <tr style="line-height: 1.2;">
	        <th style="background:]=] .. colour .. [=[; width:7em; padding-top: 0; padding-bottom: 0;"">feminine</th>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "f", 1) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "f", 2) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "f", 3) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "f", 3, 1) .. [=[</span></td>
	    </tr>
	    <tr style="line-height: 1.2;">
	        <th style="background:]=] .. colour .. [=[; width:7em; padding-top: 0;">neuter</th>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "n", 1) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "n", 2) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "n", 3) .. [=[</span></td>
	        <td><span lang=\"rsk\">]=] .. check_add_alt_comp(forms, tense, mood, "n", 3, 1) .. [=[</span></td>
	    </tr>]=]
	    row = row .. add_row_separator()
	end 

    return row
end

function make_table_footer()
    local header = =]

    return header
end
 
-- Make the table
function make_table(forms, title, cats, params)
 
    if cats then
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        --alternatives
        forms = nil
        forms = nil
        forms = nil
        forms = nil
        forms = nil
        --forms = nil
        --forms = nil
        --forms = nil
        --forms = nil
        forms = nil
        forms = nil
        forms = nil
        forms = nil
        forms = nil
    end
 
    -- Perfective verbs have no present forms.
    if cats then
        if not params then
        	forms = ""
        end
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        --alternatives
        forms = nil
        forms = nil
        forms = nil
        forms = nil
        forms = nil
        forms = nil
        forms = nil
 
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        -- alternatives
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms        
    else
    	forms = ""
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        -- alternatives
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms
        forms = forms  
    end

    if cats then
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        forms = ""
        --alternatives
        forms = nil
        forms = nil
        forms = nil
        forms = nil
        forms = nil
    end
 
    local inf = forms
 
    for key, form in pairs(forms) do
        -- check for empty strings and nil's
        if form == "" or not form then
            forms = "&mdash;"
        end
    end

    local final = make_table_header(title)
    final = final .. make_simple_row("infinitive", inf)

    final = final .. make_mood_header("indicative", "#A0ADE3")

    if not cats then
        final = final .. make_full_row(
            "present",
            "#C0CFE4",
            check_add_alt(forms, "pres_1sg", cats),
            check_add_alt(forms, "pres_2sg", cats),
            check_add_alt(forms, "pres_3sg", cats),
            check_add_alt(forms, "pres_3sg", "subject"),
            check_add_alt(forms, "pres_1pl", cats),
            check_add_alt(forms, "pres_2pl", cats),
            check_add_alt(forms, "pres_3pl", cats),
            check_add_alt(forms, "pres_3pl", "subject")
        )
    end
    final = final .. make_full_row_comp("past", "#C0CFE4", forms, "ind", cats, nil)
    final = final .. make_full_row_comp("past perfect", "#C0CFE4", forms, "ind", cats, nil)
    if cats then
        final = final .. make_full_row(
            "future",
            "#C0CFE4",
            check_add_alt(forms, "futr_1sg", cats),
            check_add_alt(forms, "futr_2sg", cats),
            check_add_alt(forms, "futr_3sg", cats),
            check_add_alt(forms, "futr_3sg", "subject"),
            check_add_alt(forms, "futr_1pl", cats),
            check_add_alt(forms, "futr_2pl", cats),
            check_add_alt(forms, "futr_3pl", cats),
            check_add_alt(forms, "futr_3pl", "subject")
        )
    else
        final = final .. make_full_row(
            "future",
            "#C0CFE4",
            create_composite(nil, inf, "fut", nil, 1, nil, cats),
            create_composite(nil, inf, "fut", nil, 2, nil, cats),
            create_composite(nil, inf, "fut", nil, 3, nil, cats),
            create_composite(nil, inf, "fut", nil, 3, nil, "subject"),
            create_composite(nil, inf, "fut", nil, 4, nil, cats),
            create_composite(nil, inf, "fut", nil, 5, nil, cats),
            create_composite(nil, inf, "fut", nil, 6, nil, cats),
            create_composite(nil, inf, "fut", nil, 6, nil, "subject")
        )
    end


    final = final .. make_mood_header("conditional", "#A7D8B8")
    final = final .. make_full_row_comp("present", "#B2E8A6", forms, "cond", cats, 1)
    final = final .. make_full_row_comp("past", "#B2E8A6", forms, "cond", cats, 1)

	if (forms and forms and forms and not params and not cats) then
	    final = final .. make_mood_header("imperative", "#F4A7A7")
	    final = final .. make_full_row(
	        "present",
	        "#F7B2B7",
	        "—",
	        check_add_alt(forms, "impr_2sg", cats),
	        "—",
	        "—",
	        check_add_alt(forms, "impr_1pl", cats),
	        check_add_alt(forms, "impr_2pl", cats),
	        "—",
	        "—"
	    )
	end
	
	
	
	local pres_actv_part_final, pasv_part_final, gerund_final = "&mdash;", "&mdash;", "&mdash;"
	if not params and (not cats or params) and (not cats or cats or params) then
    	pres_actv_part_final = check_add_alt(forms, "pres_actv_part", cats)
	end

	if not params and (not cats or params) and (not cats or cats or params) then
    	pasv_part_final = check_add_alt(forms, "pres_pasv_part", cats)
	end
	
	if params then
		pres_actv_part_final = check_add_alt(forms, "pres_actv_part", cats)
		forms = "&mdash;"
		pasv_part_final = check_add_alt(forms, "pres_pasv_part", cats)
	end

    if not params then
    	gerund_final = check_add_alt(forms, "gerund", cats)
    end
	
	final = final .. make_indecl_header("#F3F781")
	final = final .. make_full_row5(
        "non-finite",
        "#F2F5A9",
        pres_actv_part_final,
        check_add_alt(forms, "past_actv_part", cats),
        pasv_part_final,
        check_add_alt(forms, "past_m", cats),
        gerund_final
    )

    final = final .. make_table_footer()
 
    return final
end
 
return export