Module:ru-noun

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:ru-noun/documentation. [edit]
Text-x-generic with pencil.svg This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

--[=[
    This module contains functions for creating inflection tables for Russian
    nouns.
 
    Arguments:
        1: stress pattern number
        2: stem
        3: declension type (usually just the ending)
        4: suffixless form (optional, default = stem)
 
    Case abbreviations:
        nom: nominative
        gen: genitive
        dat: dative
        acc: accusative
        ins: instrumental
        pre: prepositional
        par: partitive
        loc: locative
        voc: vocative
]=]--
 
local m_utilities = require("Module:utilities")
local m_links = require("Module:links")
local com = require("Module:ru-common")
local strutils = require("Module:string utilities")
 
local export = {}
 
local lang = require("Module:languages").getByCode("ru")
 
local declensions = {}
local stress_patterns = {}
 
-- 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
    SUBPAGENAME = mw.title.getCurrentTitle().subpageText
    NAMESPACE = mw.title.getCurrentTitle().nsText
 
    args["a"] = args["a"] and (args["a"] ~= "") and string.sub(args["a"], 1, 1) or "i"
    args["n"] = args["n"] and (args["n"] ~= "") and string.sub(args["n"], 1, 1) or nil
 
    local stress_pattern = (args[1] ~= "") and args[1] or "1"
    local declension_type = args[3]
    args[4] = (args[4] ~= "") and args[4] or args[2]
    args[1] = com.make_unstressed_once(args[2])
    args[3] = com.make_unstressed_once(args[4])
 
    args["hint"] = mw.ustring.sub(args[2], -1)
 
    stress_patterns[stress_pattern](args, declensions[declension_type])
 
    return make_table(args)
end
 
declensions[""] = {
    ["nom_sg"] = "",
    ["gen_sg"] = "а́",
    ["dat_sg"] = "у́",
    ["acc_sg"] = nil,
    ["ins_sg"] = "о́м",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "ы́",
    ["gen_pl"] = "о́в",
    ["dat_pl"] = "а́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "а́ми",
    ["pre_pl"] = "а́х",
}
 
declensions["-а"] = {
    ["nom_sg"] = "",
    ["gen_sg"] = "а́",
    ["dat_sg"] = "у́",
    ["acc_sg"] = nil,
    ["ins_sg"] = "о́м",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "а́",
    ["gen_pl"] = "о́в",
    ["dat_pl"] = "а́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "а́ми",
    ["pre_pl"] = "а́х",
}
 
declensions["-ья"] = {
    ["nom_sg"] = "",
    ["gen_sg"] = "а́",
    ["dat_sg"] = "у́",
    ["acc_sg"] = nil,
    ["ins_sg"] = "о́м",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "ья́",
    ["gen_pl"] = "ьёв",
    ["dat_pl"] = "ья́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "ья́ми",
    ["pre_pl"] = "ья́х",
}
 
declensions["а"] = {
    ["nom_sg"] = "а́",
    ["gen_sg"] = "ы́",
    ["dat_sg"] = "е́",
    ["acc_sg"] = "у́",
    ["ins_sg"] = {"о́й", "о́ю"},
    ["pre_sg"] = "е́",
    ["nom_pl"] = "ы́",
    ["gen_pl"] = "",
    ["dat_pl"] = "а́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "а́ми",
    ["pre_pl"] = "а́х",
}
 
declensions["о"] = {
    ["nom_sg"] = "о́",
    ["gen_sg"] = "а́",
    ["dat_sg"] = "у́",
    ["acc_sg"] = "о́",
    ["ins_sg"] = "о́м",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "а́",
    ["gen_pl"] = "",
    ["dat_pl"] = "а́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "а́ми",
    ["pre_pl"] = "а́х",
}
 
declensions["о-и"] = {
    ["nom_sg"] = "о́",
    ["gen_sg"] = "а́",
    ["dat_sg"] = "у́",
    ["acc_sg"] = "о́",
    ["ins_sg"] = "о́м",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "ы́",
    ["gen_pl"] = "",
    ["dat_pl"] = "а́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "а́ми",
    ["pre_pl"] = "а́х",
}
 
declensions["о-ы"] = declensions["о-и"]
 
declensions["е"] = {
    ["nom_sg"] = "ё",
    ["gen_sg"] = "я́",
    ["dat_sg"] = "ю́",
    ["acc_sg"] = "ё",
    ["ins_sg"] = "ём",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "я́",
    ["gen_pl"] = "е́й",
    ["dat_pl"] = "я́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "я́ми",
    ["pre_pl"] = "я́х",
}
 
declensions["ь-m"] = {
    ["nom_sg"] = "ь",
    ["gen_sg"] = "я́",
    ["dat_sg"] = "ю́",
    ["acc_sg"] = nil,
    ["ins_sg"] = "ём",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "и́",
    ["gen_pl"] = "е́й",
    ["dat_pl"] = "я́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "я́ми",
    ["pre_pl"] = "я́х",
}
 
declensions["я"] = {
    ["nom_sg"] = "я́",
    ["gen_sg"] = "и́",
    ["dat_sg"] = "е́",
    ["acc_sg"] = "ю́",
    ["ins_sg"] = {"ёй", "ёю"},
    ["pre_sg"] = "е́",
    ["nom_pl"] = "и́",
    ["gen_pl"] = "й",
    ["dat_pl"] = "я́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "я́ми",
    ["pre_pl"] = "я́х",
}
 
declensions["й"] = {
    ["nom_sg"] = "й",
    ["gen_sg"] = "я́",
    ["dat_sg"] = "ю́",
    ["acc_sg"] = nil,
    ["ins_sg"] = "ём",
    ["pre_sg"] = "е́",
    ["nom_pl"] = "и́",
    ["gen_pl"] = "ёв",
    ["dat_pl"] = "я́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "я́ми",
    ["pre_pl"] = "я́х",
}
 
declensions["ьё"] = {
    ["nom_sg"] = "ьё",
    ["gen_sg"] = "ья́",
    ["dat_sg"] = "ью́",
    ["acc_sg"] = "ьё",
    ["ins_sg"] = "ьём",
    ["pre_sg"] = "ье́",
    ["nom_pl"] = "ья́",
    ["gen_pl"] = "е́й",
    ["dat_pl"] = "ья́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "ья́ми",
    ["pre_pl"] = "ья́х",
}
 
declensions["ье"] = declensions["ьё"]
 
declensions["ие"] = {
    ["nom_sg"] = "ие",
    ["gen_sg"] = "ия",
    ["dat_sg"] = "ию",
    ["acc_sg"] = "ие",
    ["ins_sg"] = "ием",
    ["pre_sg"] = "ии",
    ["nom_pl"] = "ия́",
    ["gen_pl"] = "ий",
    ["dat_pl"] = "ия́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "ия́ми",
    ["pre_pl"] = "ия́х",
}
 
declensions["ий"] = {
    ["nom_sg"] = "ий",
    ["gen_sg"] = "ия́",
    ["dat_sg"] = "ию́",
    ["acc_sg"] = nil,
    ["ins_sg"] = "иём",
    ["pre_sg"] = "ии́",
    ["nom_pl"] = "ии́",
    ["gen_pl"] = "иёв",
    ["dat_pl"] = "ия́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "ия́ми",
    ["pre_pl"] = "ия́х",
}
 
declensions["ия"] = {
    ["nom_sg"] = "ия́",
    ["gen_sg"] = "ии́",
    ["dat_sg"] = "ии́",
    ["acc_sg"] = "ию́",
    ["ins_sg"] = {"иёй", "иёю"},
    ["pre_sg"] = "ии́",
    ["nom_pl"] = "ии́",
    ["gen_pl"] = "и́й",
    ["dat_pl"] = "ия́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "ия́ми",
    ["pre_pl"] = "ия́х",
}
 
declensions["ь-f"] = {
    ["nom_sg"] = "ь",
    ["gen_sg"] = "и́",
    ["dat_sg"] = "и́",
    ["acc_sg"] = "ь",
    ["ins_sg"] = "ью́",
    ["pre_sg"] = "и́",
    ["nom_pl"] = "и́",
    ["gen_pl"] = "е́й",
    ["dat_pl"] = "я́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "я́ми",
    ["pre_pl"] = "я́х",
}
 
declensions["ин"] = {
    ["nom_sg"] = "и́н",
    ["gen_sg"] = "и́на",
    ["dat_sg"] = "и́ну",
    ["acc_sg"] = nil,
    ["ins_sg"] = "и́ном",
    ["pre_sg"] = "и́не",
    ["nom_pl"] = "е́",
    ["gen_pl"] = "",
    ["dat_pl"] = "а́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "а́ми",
    ["pre_pl"] = "а́х",
}
 
declensions["ёнок"] = {
    ["nom_sg"] = "ёнок",
    ["gen_sg"] = "ёнка",
    ["dat_sg"] = "ёнку",
    ["acc_sg"] = nil,
    ["ins_sg"] = "ёнком",
    ["pre_sg"] = "ёнке",
    ["nom_pl"] = "я́та",
    ["gen_pl"] = "я́т",
    ["dat_pl"] = "я́там",
    ["acc_pl"] = nil,
    ["ins_pl"] = "я́тами",
    ["pre_pl"] = "я́тах",
}
 
declensions["онок"] = declensions["ёнок"]
 
declensions["мя"] = {
    ["nom_sg"] = "мя",
    ["gen_sg"] = "мени",
    ["dat_sg"] = "мени",
    ["acc_sg"] = nil,
    ["ins_sg"] = "менем",
    ["pre_sg"] = "мени",
    ["nom_pl"] = "мена́",
    ["gen_pl"] = "мён",
    ["dat_pl"] = "мена́м",
    ["acc_pl"] = nil,
    ["ins_pl"] = "мена́ми",
    ["pre_pl"] = "мена́х",
}
 
declensions["мя-1"] = {
    ["nom_sg"] = "мя",
    ["gen_sg"] = "мени",
    ["dat_sg"] = "мени",
    ["acc_sg"] = nil,
    ["ins_sg"] = "менем",
    ["pre_sg"] = "мени",
    ["nom_pl"] = "мёна",
    ["gen_pl"] = "мён",
    ["dat_pl"] = "мёнам",
    ["acc_pl"] = nil,
    ["ins_pl"] = "мёнами",
    ["pre_pl"] = "мёнах",
}
 
local stressed_sibilant_rules = {
    ["я"] = "а",
    ["ы"] = "и",
    ["ё"] = "о́",
    ["ю"] = "у",
}
 
local stressed_c_rules = {
    ["я"] = "а",
    ["ё"] = "о́",
    ["ю"] = "у",
}
 
local unstressed_sibilant_rules = {
    ["я"] = "а",
    ["ы"] = "и",
    ["о"] = "е",
    ["ю"] = "у",
}
 
local unstressed_c_rules = {
    ["я"] = "а",
    ["о"] = "е",
    ["ю"] = "у",
}
 
local velar_rules = {
    ["ы"] = "и",
}
 
local stressed_rules = {
    ["ш"] = stressed_sibilant_rules,
    ["щ"] = stressed_sibilant_rules,
    ["ч"] = stressed_sibilant_rules,
    ["ж"] = stressed_sibilant_rules,
    ["ц"] = stressed_c_rules,
    ["к"] = velar_rules,
    ["г"] = velar_rules,
    ["х"] = velar_rules,
}
 
local unstressed_rules = {
    ["ш"] = unstressed_sibilant_rules,
    ["щ"] = unstressed_sibilant_rules,
    ["ч"] = unstressed_sibilant_rules,
    ["ж"] = unstressed_sibilant_rules,
    ["ц"] = unstressed_c_rules,
    ["к"] = velar_rules,
    ["г"] = velar_rules,
    ["х"] = velar_rules,
}
 
local consonantal_suffixes = {
    [""] = true,
    ["ь"] = true,
    ["й"] = true,
}
 
local function attach_unstressed(args, suf)
    if suf == nil then
        return nil
    elseif consonantal_suffixes[suf] then
        if mw.ustring.find(args[4], "[йь]$") then
            return args[4]
        else
            if suf == "й" or suf == "ь" then
                if mw.ustring.find(args[4], "[аеёиіоуэюяѣ́]$") then
                    suf = "й"
                else
                    suf = "ь"
                end
            end
            return args[4] .. suf
        end
    end
    suf = com.make_unstressed(suf)
    local first = mw.ustring.sub(suf, 1, 1)
    local rules = unstressed_rules[args["hint"]]
    if rules then
        local conv = rules[first]
        if conv then
            suf = conv .. mw.ustring.sub(suf, 2)
        end
    end
    return args[2] .. suf
end
 
local function attach_stressed(args, suf)
    if suf == nil then
        return nil
    elseif not mw.ustring.find(suf, "[ё́]") then -- if suf has no "ё" or accent marks
        return attach_unstressed(args, suf)
    end
    local first = mw.ustring.sub(suf, 1, 1)
    local rules = stressed_rules[args["hint"]]
    if rules then
        local conv = rules[first]
        if conv then
            suf = conv .. mw.ustring.sub(suf, 2)
        end
    end
    return args[1] .. suf
end
 
local function attach_with(args, suf, fun)
    if type(suf) == "table" then
        local tbl = {}
        for _, x in ipairs(suf) do
            table.insert(tbl, attach_with(args, x, fun))
        end
        return tbl
    else
        return fun(args, suf)
    end
end
 
local function gen_form(args, decl, case, fun)
    args[case] = (args[case] ~= "") and args[case] or attach_with(args, decl[case], fun)
end
 
stress_patterns["1"] = function(args, decl)
    gen_form(args, decl, "nom_sg", attach_unstressed)
    gen_form(args, decl, "gen_sg", attach_unstressed)
    gen_form(args, decl, "dat_sg", attach_unstressed)
    gen_form(args, decl, "acc_sg", attach_unstressed)
    gen_form(args, decl, "ins_sg", attach_unstressed)
    gen_form(args, decl, "pre_sg", attach_unstressed)
    gen_form(args, decl, "nom_pl", attach_unstressed)
    gen_form(args, decl, "gen_pl", attach_unstressed)
    gen_form(args, decl, "dat_pl", attach_unstressed)
    gen_form(args, decl, "acc_pl", attach_unstressed)
    gen_form(args, decl, "ins_pl", attach_unstressed)
    gen_form(args, decl, "pre_pl", attach_unstressed)
end
 
stress_patterns["2"] = function(args, decl)
    gen_form(args, decl, "nom_sg", attach_stressed)
    gen_form(args, decl, "gen_sg", attach_stressed)
    gen_form(args, decl, "dat_sg", attach_stressed)
    gen_form(args, decl, "acc_sg", attach_stressed)
    gen_form(args, decl, "ins_sg", attach_stressed)
    gen_form(args, decl, "pre_sg", attach_stressed)
    gen_form(args, decl, "nom_pl", attach_stressed)
    gen_form(args, decl, "gen_pl", attach_stressed)
    gen_form(args, decl, "dat_pl", attach_stressed)
    gen_form(args, decl, "acc_pl", attach_stressed)
    gen_form(args, decl, "ins_pl", attach_stressed)
    gen_form(args, decl, "pre_pl", attach_stressed)
end
 
stress_patterns["3"] = function(args, decl)
    gen_form(args, decl, "nom_sg", attach_unstressed)
    gen_form(args, decl, "gen_sg", attach_unstressed)
    gen_form(args, decl, "dat_sg", attach_unstressed)
    gen_form(args, decl, "acc_sg", attach_unstressed)
    gen_form(args, decl, "ins_sg", attach_unstressed)
    gen_form(args, decl, "pre_sg", attach_unstressed)
    gen_form(args, decl, "nom_pl", attach_stressed)
    gen_form(args, decl, "gen_pl", attach_stressed)
    gen_form(args, decl, "dat_pl", attach_stressed)
    gen_form(args, decl, "acc_pl", attach_stressed)
    gen_form(args, decl, "ins_pl", attach_stressed)
    gen_form(args, decl, "pre_pl", attach_stressed)
end
 
stress_patterns["4"] = function(args, decl)
    gen_form(args, decl, "nom_sg", attach_stressed)
    gen_form(args, decl, "gen_sg", attach_stressed)
    gen_form(args, decl, "dat_sg", attach_stressed)
    gen_form(args, decl, "acc_sg", attach_stressed)
    gen_form(args, decl, "ins_sg", attach_stressed)
    gen_form(args, decl, "pre_sg", attach_stressed)
    gen_form(args, decl, "nom_pl", attach_unstressed)
    gen_form(args, decl, "gen_pl", attach_unstressed)
    gen_form(args, decl, "dat_pl", attach_unstressed)
    gen_form(args, decl, "acc_pl", attach_unstressed)
    gen_form(args, decl, "ins_pl", attach_unstressed)
    gen_form(args, decl, "pre_pl", attach_unstressed)
end
 
stress_patterns["5"] = function(args, decl)
    gen_form(args, decl, "nom_sg", attach_unstressed)
    gen_form(args, decl, "gen_sg", attach_unstressed)
    gen_form(args, decl, "dat_sg", attach_unstressed)
    gen_form(args, decl, "acc_sg", attach_unstressed)
    gen_form(args, decl, "ins_sg", attach_unstressed)
    gen_form(args, decl, "pre_sg", attach_unstressed)
    gen_form(args, decl, "nom_pl", attach_unstressed)
    gen_form(args, decl, "gen_pl", attach_stressed)
    gen_form(args, decl, "dat_pl", attach_stressed)
    gen_form(args, decl, "acc_pl", attach_stressed)
    gen_form(args, decl, "ins_pl", attach_stressed)
    gen_form(args, decl, "pre_pl", attach_stressed)
end
 
stress_patterns["6"] = function(args, decl)
    gen_form(args, decl, "nom_sg", attach_stressed)
    gen_form(args, decl, "gen_sg", attach_stressed)
    gen_form(args, decl, "dat_sg", attach_stressed)
    gen_form(args, decl, "acc_sg", attach_stressed)
    gen_form(args, decl, "ins_sg", attach_stressed)
    gen_form(args, decl, "pre_sg", attach_stressed)
    gen_form(args, decl, "nom_pl", attach_unstressed)
    gen_form(args, decl, "gen_pl", attach_stressed)
    gen_form(args, decl, "dat_pl", attach_stressed)
    gen_form(args, decl, "acc_pl", attach_stressed)
    gen_form(args, decl, "ins_pl", attach_stressed)
    gen_form(args, decl, "pre_pl", attach_stressed)
end
 
local after_titles = {
    ["a"] = " (animate)",
    ["i"] = " (inanimate)",
    ["b"] = "",
}
 
local numbers = {
    ["s"] = "singular",
    ["p"] = "plural",
}
 
local form_temp = [=[<span lang="ru" class="Cyrl">{term}</span><br/><span style="color: #888">{tr}</span>]=]
local title_temp = [=[Declension of <b lang="ru" class="Cyrl">{lemma}</b>]=]
 
local partitive = nil
local locative = nil
local vocative = nil
local templates = {}
 
local cases = {
    ["nom_sg"] = true,
    ["gen_sg"] = true,
    ["dat_sg"] = true,
    ["acc_sg"] = true,
    ["ins_sg"] = true,
    ["pre_sg"] = true,
    ["nom_pl"] = true,
    ["gen_pl"] = true,
    ["dat_pl"] = true,
    ["acc_pl"] = true,
    ["ins_pl"] = true,
    ["pre_pl"] = true,
    ["par"] = true,
    ["loc"] = true,
    ["voc"] = true,
}
 
-- Make the table
function make_table(args)
    local anim = args["a"]
    local numb = args["n"]
    args["after_title"] = after_titles[anim]
    args["number"] = numbers[numb]
 
    args["lemma"] = (numb == "p") and args["nom_pl"] or args["nom_sg"]
    args["title"] = (args["title"] ~= "") and args["title"] or strutils.format(title_temp, args)
 
    if anim == "a" then
        if not args["acc_sg"] then
            args["acc_sg"] = args["gen_sg"]
        end
        if not args["acc_pl"] then
            args["acc_pl"] = args["gen_pl"]
        end
    elseif anim == "i" then
        if not args["acc_sg"] then
            args["acc_sg"] = args["nom_sg"]
        end
        if not args["acc_pl"] then
            args["acc_pl"] = args["nom_pl"]
        end
    end
 
    for case in pairs(cases) do
        if args[case] == "-" then
            args[case] = "&mdash;"
        elseif args[case] and args[case] ~= "" then
            local term = nil
            local tr = nil
            local typ = type(args[case])
            if typ ~= "table" and mw.ustring.find(args[case], ",") then
                args[case] = mw.text.split(args[case], "%s*,%s*")
                typ = type(args[case])
            end
            if typ == "table" then
                local sep = ""
                term = ""
                for _, x in ipairs(args[case]) do
                    term = term .. sep .. "[[" .. x .. "]]"
                    sep = ", "
                end
                tr = lang:transliterate(m_links.remove_links(term))
                term = m_links.language_link(term, nil, lang, nil, PAGENAME)
            else
                tr = lang:transliterate(m_links.remove_links(args[case]))
                term = m_links.language_link(args[case], nil, lang, nil, PAGENAME)
            end
            args[case] = strutils.format(form_temp, {["term"] = term, ["tr"] = tr})
        else
            args[case] = nil
        end
    end
 
    local temp = nil
 
    if numb == "s" then
        args["nom_x"] = args["nom_sg"]
        args["gen_x"] = args["gen_sg"]
        args["dat_x"] = args["dat_sg"]
        args["acc_x"] = args["acc_sg"]
        args["ins_x"] = args["ins_sg"]
        args["pre_x"] = args["pre_sg"]
        if args["acc_sg"] then
            temp = "half"
        else
            temp = "half_a"
        end
    elseif numb == "p" then
        args["nom_x"] = args["nom_pl"]
        args["gen_x"] = args["gen_pl"]
        args["dat_x"] = args["dat_pl"]
        args["acc_x"] = args["acc_pl"]
        args["ins_x"] = args["ins_pl"]
        args["pre_x"] = args["pre_pl"]
        args["par"] = nil
        args["loc"] = nil
        args["voc"] = nil
        if args["acc_pl"] then
            temp = "half"
        else
            temp = "half_a"
        end
    else
        if args["acc_pl"] then
            temp = "full"
        elseif args["acc_sg"] then
            temp = "full_af"
        else
            temp = "full_a"
        end
    end
 
    if args["par"] then
        args["par_clause"] = strutils.format(partitive, args)
    else
        args["par_clause"] = ""
    end
 
    if args["loc"] then
        args["loc_clause"] = strutils.format(locative, args)
    else
        args["loc_clause"] = ""
    end
 
    if args["voc"] then
        args["voc_clause"] = strutils.format(vocative, args)
    else
        args["voc_clause"] = ""
    end
 
    return strutils.format(templates[temp], args)
end
 
partitive = [===[
 
! style="background:#eff7ff" | partitive
| {par}
|-]===]
 
locative = [===[
 
! style="background:#eff7ff" | locative
| {loc}
|-]===]
 
vocative = [===[
 
! style="background:#eff7ff" | vocative
| {voc}
|-]===]
 
templates["full"] = [===[
<div>
<div class="NavFrame" style="display: inline-block; min-width: 45em">
<div class="NavHead" style="background:#eff7ff">{title}{after_title}</div>
<div class="NavContent">
{\op}| style="background:#F9F9F9;text-align:center; min-width:45em" class="inflection-table"
|-
! style="width:10em;background:#d9ebff" | 
! style="background:#d9ebff" | singular
! style="background:#d9ebff" | plural
|-
! style="background:#eff7ff" | nominative
| {nom_sg}
| {nom_pl}
|-
! style="background:#eff7ff" | genitive
| {gen_sg}
| {gen_pl}
|-
! style="background:#eff7ff" | dative
| {dat_sg}
| {dat_pl}
|-
! style="background:#eff7ff" | accusative
| {acc_sg}
| {acc_pl}
|-
! style="background:#eff7ff" | instrumental
| {ins_sg}
| {ins_pl}
|-
! style="background:#eff7ff" | prepositional
| {pre_sg}
| {pre_pl}
|-{par_clause}{loc_clause}{voc_clause}
|{\cl}</div></div></div>]===]
 
templates["full_a"] = [===[
<div>
<div class="NavFrame" style="display: inline-block; min-width: 50em">
<div class="NavHead" style="background:#eff7ff">{title}{after_title}</div>
<div class="NavContent">
{\op}| style="background:#F9F9F9;text-align:center; min-width:50em" class="inflection-table"
|-
! style="width:15em;background:#d9ebff" | 
! style="background:#d9ebff" | singular
! style="background:#d9ebff" | plural
|-
! style="background:#eff7ff" | nominative
| {nom_sg}
| {nom_pl}
|-
! style="background:#eff7ff" | genitive
| {gen_sg}
| {gen_pl}
|-
! style="background:#eff7ff" | dative
| {dat_sg}
| {dat_pl}
|-
! style="background:#eff7ff" rowspan="2" | accusative <span style="padding-left:1em;display:inline-block;vertical-align:middle">animate<br/>inanimate</span>
| {gen_sg}
| {gen_pl}
|-
| {nom_sg}
| {nom_pl}
|-
! style="background:#eff7ff" | instrumental
| {ins_sg}
| {ins_pl}
|-
! style="background:#eff7ff" | prepositional
| {pre_sg}
| {pre_pl}
|-{par_clause}{loc_clause}{voc_clause}
|{\cl}</div></div></div>]===]
 
templates["full_af"] = [===[
<div>
<div class="NavFrame" style="display: inline-block; min-width: 50em">
<div class="NavHead" style="background:#eff7ff">{title}{after_title}</div>
<div class="NavContent">
{\op}| style="background:#F9F9F9;text-align:center; min-width:50em" class="inflection-table"
|-
! style="width:15em;background:#d9ebff" | 
! style="background:#d9ebff" | singular
! style="background:#d9ebff" | plural
|-
! style="background:#eff7ff" | nominative
| {nom_sg}
| {nom_pl}
|-
! style="background:#eff7ff" | genitive
| {gen_sg}
| {gen_pl}
|-
! style="background:#eff7ff" | dative
| {dat_sg}
| {dat_pl}
|-
! style="background:#eff7ff" rowspan="2" | accusative <span style="padding-left:1em;display:inline-block;vertical-align:middle">animate<br/>inanimate</span>
| rowspan="2" | {acc_sg}
| {gen_pl}
|-
| {nom_pl}
|-
! style="background:#eff7ff" | instrumental
| {ins_sg}
| {ins_pl}
|-
! style="background:#eff7ff" | prepositional
| {pre_sg}
| {pre_pl}
|-{par_clause}{loc_clause}{voc_clause}
|{\cl}</div></div></div>]===]
 
templates["half"] = [===[
<div>
<div class="NavFrame" style="display: inline-block; min-width: 30em">
<div class="NavHead" style="background:#eff7ff">{title}{after_title}</div>
<div class="NavContent">
{\op}| style="background:#F9F9F9;text-align:center; min-width:30em" class="inflection-table"
|-
! style="width:10em;background:#d9ebff" | 
! style="background:#d9ebff" | {number}
|-
! style="background:#eff7ff" | nominative
| {nom_x}
|-
! style="background:#eff7ff" | genitive
| {gen_x}
|-
! style="background:#eff7ff" | dative
| {dat_x}
|-
! style="background:#eff7ff" | accusative
| {acc_x}
|-
! style="background:#eff7ff" | instrumental
| {ins_x}
|-
! style="background:#eff7ff" | prepositional
| {pre_x}
|-{par_clause}{loc_clause}{voc_clause}
|{\cl}</div></div></div>]===]
 
templates["half_a"] = [===[
<div>
<div class="NavFrame" style="display: inline-block; min-width: 35em">
<div class="NavHead" style="background:#eff7ff">{title}{after_title}</div>
<div class="NavContent">
{\op}| style="background:#F9F9F9;text-align:center; min-width:35em" class="inflection-table"
|-
! style="width:15em;background:#d9ebff" | 
! style="background:#d9ebff" | {number}
|-
! style="background:#eff7ff" | nominative
| {nom_x}
|-
! style="background:#eff7ff" | genitive
| {gen_x}
|-
! style="background:#eff7ff" | dative
| {dat_x}
|-
! style="background:#eff7ff" rowspan="2" | accusative <span style="padding-left:1em;display:inline-block;vertical-align:middle">animate<br/>inanimate</span>
| {gen_x}
|-
| {nom_x}
|-
! style="background:#eff7ff" | instrumental
| {ins_x}
|-
! style="background:#eff7ff" | prepositional
| {pre_x}
|-{par_clause}{loc_clause}{voc_clause}
|{\cl}</div></div></div>]===]
 
return export