Dokumentationen för denna modul kan skapas på Modul:ru-adj/dok /test


Modul:ru-adj/dok

local gt = require("Modul:grammar-table")
local export = require("Modul:grammar")

local lang_code_param                   = "ru"
local part_of_speech_param              = "adj"
local uncomparable_templatename_suffix  = "-okomp"

function export._getAcceptedParameters()
	return {}
end

function export._getForms(pagename, templatename, args, meta, format)
	local last_1                    = mw.ustring.sub(pagename, -1, -1)
	local last_2                    = mw.ustring.sub(pagename, -2, -1)
	local last_3                    = mw.ustring.sub(pagename, -3, -1)
	local second_last               = mw.ustring.sub(pagename, -2, -2)
	local without_last_1            = mw.ustring.sub(pagename, 1, -2)
	local without_last_2            = mw.ustring.sub(pagename, 1, -3)
	local without_last_3            = mw.ustring.sub(pagename, 1, -4)
	local stem                      = "?"
	local ending                    = ""
	local soft                      = not not last_3 == "ний"
	
	if last_3 == "ний" then
		stem   = without_last_3
		ending = last_3
	elseif last_2 == "ый" or last_2 == "ой" or last_2 == "ий" then
		stem   = without_last_2
		ending = last_2
	end
	
	local nominative_masc           = stem .. ending
	local nominative_neutr          = stem .. "ое"
	local nominative_fem            = stem .. "ая"
	local nominative_pl             = stem .. second_last .. "е"
	local genitive_masc             = stem .. "ого"
	local genitive_neutr            = genitive_masc
	local genitive_fem              = stem .. "ой"
	local genitive_pl               = stem .. second_last .. "х"
	local dative_masc               = stem .. "ому"
	local dative_neutr              = dative_masc
	local dative_fem                = stem .. "ой"
	local dative_pl                 = stem .. second_last .. "м"
	local accusative_masc_animate   = genitive_masc
	local accusative_masc_inanimate = nominative_masc
	local accusative_neutr          = stem .. "ое"
	local accusative_fem            = stem .. "ую"
	local accusative_pl_animate     = genitive_pl
	local accusative_pl_inanimate   = nominative_pl
	local instrumental_masc         = stem .. second_last .. "м"
	local instrumental_neutr        = instrumental_masc
	local instrumental_fem          = stem .. "ой, " .. stem .. "ою"
	local instrumental_pl           = stem .. second_last .. "ми"
	local prepositional_masc        = stem .. "ом"
	local prepositional_neutr       = prepositional_masc
	local prepositional_fem         = stem .. "ой"
	local prepositional_pl          = stem .. second_last .. "х"
	
	local short_masc  = stem .. ending
	local short_neutr = stem .. ".."
	local short_fem   = stem .. ".."
	local short_pl    = stem .. ".."

	if soft then
		-- soft pattern	
	end
	--

	local forms = {}
	forms.nom_mask        = args[1] or nominative_masc
	forms.gen_mask        = args[2] or genitive_masc
	forms.dat_mask        = args[3] or dative_masc
	forms.ack_mask_anim   = args[4] or accusative_masc_animate
	forms.ack_mask_inanim = args[5] or accusative_masc_inanimate
	forms.ins_mask        = args[6] or instrumental_masc
	forms.lok_mask        = args[7] or prepositional_masc

	forms.nom_neutr       = args[8] or nominative_neutr
	forms.gen_neutr       = args[2] or genitive_neutr
	forms.dat_neutr       = args[3] or dative_neutr
	forms.ack_neutr       = args[9] or accusative_neutr
	forms.ins_neutr       = args[6] or instrumental_neutr
	forms.lok_neutr       = args[7] or prepositional_neutr

	forms.nom_fem         = args[10] or nominative_fem
	forms.gen_fem         = args[11] or genitive_fem
	forms.dat_fem         = args[12] or dative_fem
	forms.ack_fem         = args[13] or accusative_fem
	forms.ins_fem         = args[14] or instrumental_fem
	forms.lok_fem         = args[15] or prepositional_fem

	forms.nom_pl          = args[16] or nominative_pl
	forms.gen_pl          = args[17] or genitive_pl
	forms.dat_pl          = args[18] or dative_pl
	forms.ack_pl_anim     = args[19] or accusative_pl_animate
	forms.ack_pl_inanim   = args[20] or accusative_pl_inanimate
	forms.ins_pl          = args[21] or instrumental_pl
	forms.lok_pl          = args[22] or prepositional_pl

	local no_short = args["kort"] == "-"
	forms.kort_mask       = no_short and "-" or args[23] or short_masc
	forms.kort_neutr      = no_short and "-" or args[24] or short_neutr
	forms.kort_fem        = no_short and "-" or args[25] or short_fem
	forms.kort_pl         = no_short and "-" or args[26] or short_pl

	return forms
end

function export._getMeta(pagename, templatename, args)
	local can_not_be_compared = mw.ustring.sub(templatename, -mw.ustring.len(uncomparable_templatename_suffix), -1) == uncomparable_templatename_suffix

	local meta = {}
	meta.numbered_cells = 26
	meta.named_cells    = {}
	meta.uncomp         = can_not_be_compared

	return meta
end

function export._getWikitable(forms, meta)
	local number_of_columns          = 6
	local contains_a_quality_notice  = not not meta.quality_notice
	local note                       = meta.note
	local as_first_part              = meta.as_first_part
	local comparation_text           = ""
	local is_uncomparable            = meta.uncomp
	
	gt.setLanguage(lang_code_param)

	if is_uncomparable then
		comparation_text = "Kompareras inte."
	else
		comparation_text = "Kan kompareras."
	end

	local str = gt.getStart(number_of_columns, lang_code_param, part_of_speech_param, contains_a_quality_notice)
	.. gt.getRow({'!class="main min" rowspan="2" colspan="2"', 'Böjningar av ' .. meta.pagename .. ' ' .. meta.meanings}, {'!colspan="3"', 'Singular'}, {'!rowspan="2"', 'Plural'})
	.. gt.getRow(                                                  {'!', 'Maskulinum'}, {'!', 'Neutrum'}, {'!', 'Femininum'})
	.. gt.getRow({'!colspan="2"', 'Nominativ'},                    forms.nom_mask, forms.nom_neutr,                        forms.nom_fem,                   forms.nom_pl)
	.. gt.getRow({'!colspan="2"', 'Genitiv'},                      {'|colspan="2"', forms.gen_mask},                       forms.gen_fem,                   forms.gen_pl)
	.. gt.getRow({'!colspan="2"', 'Dativ'},                        {'|colspan="2"', forms.dat_mask},                       forms.dat_fem,                   forms.dat_pl)
	.. gt.getRow({'!rowspan="2"', 'Ackusativ'}, {'!', 'Animat'},   forms.ack_mask_anim, {'|rowspan="2"', forms.ack_neutr}, {'|rowspan="2"', forms.ack_fem}, forms.ack_pl_anim)
	.. gt.getRow(                               {'!', 'Inanimat'}, forms.ack_mask_inanim,                                                                   forms.ack_pl_inanim)
	.. gt.getRow({'!colspan="2"', 'Instrumentalis'},               {'|colspan="2"', forms.ins_mask},                       forms.ins_fem,                   forms.ins_pl)
	.. gt.getRow({'!colspan="2"', 'Lokativ'},                      {'|colspan="2"', forms.lok_mask},                       forms.lok_fem,                   forms.lok_pl)
	.. gt.getRow({'!colspan="6"', comparation_text})
	.. gt.getEnd(number_of_columns, note, as_first_part)
	
	return str
end

function export._getCategories(forms, meta)
	local str = ""

	return str
end

return export