Dokumentation för denna modul finns på /dok (redigera), /test
Stödja mallarna {{el-subst-m}}
, {{el-subst-f}}
, {{el-subst-n}}
, {{el-subst-m-oräkn}}
, {{el-subst-f-oräkn}}
och {{el-subst-n-oräkn}}
.
local gt = require("Modul:grammar-table")
local export = require("Modul:grammar")
local lang_code_param = "el"
local part_of_speech_param = "subst"
local masculine_templatename = "el-subst-m"
local feminine_templatename = "el-subst-f"
local neuter_templatename = "el-subst-n"
local uncountable_templatename_suffix = "-oräkn"
function export._getAcceptedParameters()
return {}
end
function export._getForms(pagename, templatename, args, meta, format)
local sing_nom = pagename
local sing_gen = "?"
local sing_ack = "?"
local sing_vok = "?"
local plur_nom = "?"
local plur_gen = "?"
local plur_ack = "?"
local plur_vok = "?"
local forms = {}
forms.sing_nom = args or sing_nom
forms.sing_gen = args or sing_gen
forms.sing_ack = args or sing_ack
forms.sing_vok = args or sing_vok
forms.plur_nom = args or plur_nom
forms.plur_gen = args or plur_gen
forms.plur_ack = args or plur_ack
forms.plur_vok = args or plur_vok
if format == "wikitable" or format == "export" then
local word_is_uncountable = meta.uncountable
if word_is_uncountable then
forms.sing_nom = nil
forms.sing_gen = nil
forms.sing_ack = nil
forms.sing_vok = nil
forms.plur_nom = nil
forms.plur_gen = nil
forms.plur_ack = nil
forms.plur_vok = nil
forms.nom = args or sing_nom
forms.gen = args or sing_gen
forms.ack = args or sing_ack
forms.vok = args or sing_vok
end
end
return forms
end
function export._getMeta(pagename, templatename, args)
local gender = ""
local uncountable = mw.ustring.sub(templatename, -mw.ustring.len(uncountable_templatename_suffix), -1) == uncountable_templatename_suffix
local is_masculine = mw.ustring.sub(templatename, 1, mw.ustring.len(masculine_templatename)) == masculine_templatename
local is_feminine = mw.ustring.sub(templatename, 1, mw.ustring.len(feminine_templatename)) == feminine_templatename
local is_neuter = mw.ustring.sub(templatename, 1, mw.ustring.len(neuter_templatename)) == neuter_templatename
if is_masculine then
gender = "m"
elseif is_feminine then
gender = "f"
elseif is_neuter then
gender = "n"
end
local meta = {}
meta.numbered_cells = uncountable and 4 or 8
meta.named_cells = {}
meta.gender = gender
meta.uncountable = uncountable
return meta
end
function export._getWikitable(forms, meta)
local contains_a_quality_notice = not not meta.quality_notice
local gender = meta.gender
local note = meta.note
local as_first_part = meta.as_first_part
local gender_cell = {}
local countable = not meta.uncountable
local number_of_columns = countable and 3 or 2
gt.setLanguage(lang_code_param)
if gender == "m" then
gender_cell = {'!class="main"', "maskulinum"}
elseif gender == "f" then
gender_cell = {'!class="main"', "femininum"}
elseif gender == "n" then
gender_cell = {'!class="main"', "neutrum"}
end
local str = gt.getStart(number_of_columns, lang_code_param, part_of_speech_param, contains_a_quality_notice)
if countable then
str = str .. gt.getRow({'!class="main min"', 'Böjningar av ' .. meta.pagename .. ' ' .. meta.meanings}, {'! rowspan="2"', 'Singular'}, {'! rowspan="2"', 'Plural'})
str = str .. gt.getRow(gender_cell)
str = str .. gt.getRow({'!', 'Nominativ'}, forms.sing_nom, forms.plur_nom)
str = str .. gt.getRow({'!', 'Genitiv'}, forms.sing_gen, forms.plur_gen)
str = str .. gt.getRow({'!', 'Ackusativ'}, forms.sing_ack, forms.plur_ack)
str = str .. gt.getRow({'!', 'Vokativ'}, forms.sing_vok, forms.plur_vok)
else
str = str .. gt.getRow({'!class="main min"', 'Böjningar av ' .. meta.pagename .. ' ' .. meta.meanings}, {'! rowspan="2"', 'Oräknebart'})
str = str .. gt.getRow(gender_cell)
str = str .. gt.getRow({'!', 'Nominativ'}, forms.nom)
str = str .. gt.getRow({'!', 'Genitiv'}, forms.gen)
str = str .. gt.getRow({'!', 'Ackusativ'}, forms.ack)
str = str .. gt.getRow({'!', 'Vokativ'}, forms.vok)
end
str = str .. gt.getEnd(number_of_columns, note, as_first_part)
return str
end
function export._getCategories(forms, meta)
local str = ""
return str
end
return export