Dokumentationen för denna modul kan skapas på Modul:be-verb/dok /test
local gt = require("Modul:grammar-table")
local export = require("Modul:grammar")
local lang_code_param = "be"
local part_of_speech_param = "verb"
local past_participle_passive_param = "ppp"
local imperfective_templatename = "be-verb-impf"
local perfective_templatename = "be-verb-pf"
local imperfective_and_perfective_templatename = "be-verb-impfpf"
function export._getAcceptedParameters()
return {past_participle_passive_param}
end
function export._getForms(pagename, templatename, args, meta, format)
local forms = {}
if meta.aspect == "impf" or meta.aspect == "impfpf" then
forms.pres_sing_1_pers = args or "?"
forms.pres_sing_2_pers = args or "?"
forms.pres_sing_3_pers = args or "?"
forms.pres_plur_1_pers = args or "?"
forms.pres_plur_2_pers = args or "?"
forms.pres_plur_3_pers = args or "?"
forms.x_pres_gerund = args or "?"
forms.x_pret_gerund = args or "?"
end
if meta.aspect == "pf" or meta.aspect == "impfpf" then
forms.fut_sing_1_pers = args or "?"
forms.fut_sing_2_pers = args or "?"
forms.fut_sing_3_pers = args or "?"
forms.fut_plur_1_pers = args or "?"
forms.fut_plur_2_pers = args or "?"
forms.fut_plur_3_pers = args or "?"
end
if meta.aspect == "pf" then
forms.x_pret_gerund = args or "?"
end
forms.pret_sing_mask = args or "?"
forms.pret_sing_neutr = args or "?"
forms.pret_sing_fem = args or "?"
forms.pret_plur = args or "?"
forms.imp_sing = args or "?"
forms.imp_plur = args or "?"
forms.x_pret_part_pass = args ~= "" and args or "-"
return forms
end
function export._getMeta(pagename, templatename, args)
local is_imperfective = templatename == imperfective_templatename or templatename == imperfective_and_perfective_templatename
local is_perfective = templatename == perfective_templatename or templatename == imperfective_and_perfective_templatename
local aspect = ""
local numbered_cells = 0
local basic_form_is_given = args;
if is_imperfective and is_perfective then
aspect = "impfpf"
numbered_cells = 14
elseif is_imperfective then
aspect = "impf"
numbered_cells = 14
elseif is_perfective then
aspect = "pf"
numbered_cells = 13
end
local meta = {}
meta.numbered_cells = numbered_cells
meta.named_cells = {}
meta.aspect = aspect
meta.basic_form_is_given = basic_form_is_given
return meta
end
function export._getWikitable(forms, meta)
local contains_a_quality_notice = not not meta.quality_notice
local note = meta.note
local as_first_part = meta.as_first_part
local number_of_columns = 4
local aspect = meta.aspect
local aspect_cell = {}
local present_or_future_cell = {}
local table_section_divider = '|-\n!colspan="4" style="background:#BFB76D; padding:1px;"|\n|-\n' --should be somewhere else
local pres_or_fut_sing_1_pers = ""
local pres_or_fut_sing_2_pers = ""
local pres_or_fut_sing_3_pers = ""
local pres_or_fut_plur_1_pers = ""
local pres_or_fut_plur_2_pers = ""
local pres_or_fut_plur_3_pers = ""
if aspect == "impf" then
aspect_cell = {'!class="main" colspan="2"', "imperfektiv"}
present_or_future_cell = {'!rowspan="3"', "Presens"}
pres_or_fut_sing_1_pers = forms.pres_sing_1_pers
pres_or_fut_sing_2_pers = forms.pres_sing_2_pers
pres_or_fut_sing_3_pers = forms.pres_sing_3_pers
pres_or_fut_plur_1_pers = forms.pres_plur_1_pers
pres_or_fut_plur_2_pers = forms.pres_plur_2_pers
pres_or_fut_plur_3_pers = forms.pres_plur_3_pers
elseif aspect == "pf" then
aspect_cell = {'!class="main" colspan="2"', "perfektiv"}
present_or_future_cell = {'!rowspan="3"', "Futurum"}
pres_or_fut_sing_1_pers = forms.fut_sing_1_pers
pres_or_fut_sing_2_pers = forms.fut_sing_2_pers
pres_or_fut_sing_3_pers = forms.fut_sing_3_pers
pres_or_fut_plur_1_pers = forms.fut_plur_1_pers
pres_or_fut_plur_2_pers = forms.fut_plur_2_pers
pres_or_fut_plur_3_pers = forms.fut_plur_3_pers
elseif aspect == "impfpf" then
aspect_cell = {'!class="main" colspan="2"', "imperfektiv och perfektiv"}
present_or_future_cell = {'!rowspan="3"', "Presens / Futurum"}
pres_or_fut_sing_1_pers = forms.fut_sing_1_pers
pres_or_fut_sing_2_pers = forms.fut_sing_2_pers
pres_or_fut_sing_3_pers = forms.fut_sing_3_pers
pres_or_fut_plur_1_pers = forms.fut_plur_1_pers
pres_or_fut_plur_2_pers = forms.fut_plur_2_pers
pres_or_fut_plur_3_pers = forms.fut_plur_3_pers
end
gt.setLanguage(lang_code_param)
local str = ""
str = str
.. gt.getStart(number_of_columns, lang_code_param, part_of_speech_param, contains_a_quality_notice)
.. gt.getRow({'!class="main min" colspan="2"', 'Böjningar av ' .. meta.pagename .. ' ' .. meta.meanings}, {'!rowspan="2"', 'Singular'}, {'!rowspan="2"', 'Plural'})
.. gt.getRow(aspect_cell)
.. gt.getRow(present_or_future_cell, {'!', '1:a person'}, pres_or_fut_sing_1_pers, pres_or_fut_plur_1_pers)
.. gt.getRow( {'!', '2:a person'}, pres_or_fut_sing_2_pers, pres_or_fut_plur_2_pers)
.. gt.getRow( {'!', '3:e person'}, pres_or_fut_sing_3_pers, pres_or_fut_plur_3_pers)
.. gt.getRow({'!rowspan="3"', "Preteritum"}, {'!', 'Maskulinum'}, forms.pret_sing_mask, {'|rowspan="3"', forms.pret_plur})
.. gt.getRow( {'!', 'Neutrum'}, forms.pret_sing_neutr)
.. gt.getRow( {'!', 'Femininum'}, forms.pret_sing_fem)
.. gt.getRow({'!', "Imperativ"}, {'!', '2:a person'}, forms.imp_sing, forms.imp_plur)
.. table_section_divider
.. gt.getRow({'!', "Particip"}, {'!', "Aktiv"}, {'!', "Passiv"}, {'!', "Gerundium"})
if aspect == "impf" or aspect == "impfpf" then
str = str
.. gt.getRow({'!', "Presens"}, '-', '-', {'|', forms.x_pres_gerund, type='some_recognizable_adv_type_here'})
end
str = str
.. gt.getRow({'!', "Preteritum"}, '-', {'|', forms.x_pret_part_pass, type='some_recognizable_adv_type_here'}, {'|', forms.x_pret_gerund, type='some_recognizable_adv_type_here'})
.. gt.getEnd(number_of_columns, note, as_first_part)
return str
end
function export._getCategories(forms, meta)
local basic_form_is_not_given = not meta.basic_form_is_given
local one_or_more_forms_are_missing =
forms.pres_sing_1_pers == "?" or
forms.pres_sing_2_pers == "?" or
forms.pres_sing_3_pers == "?" or
forms.pres_plur_1_pers == "?" or
forms.pres_plur_2_pers == "?" or
forms.pres_plur_3_pers == "?" or
forms.fut_sing_1_pers == "?" or
forms.fut_sing_2_pers == "?" or
forms.fut_sing_3_pers == "?" or
forms.fut_plur_1_pers == "?" or
forms.fut_plur_2_pers == "?" or
forms.fut_plur_3_pers == "?" or
forms.pret_sing_mask == "?" or
forms.pret_sing_neutr == "?" or
forms.pret_sing_fem == "?" or
forms.pret_plur == "?" or
forms.imp_sing == "?" or
forms.imp_plur == "?" or
forms.x_pres_gerund == "?" or
forms.x_pret_gerund == "?" or
forms.x_pret_part_pass == "?"
local str = ""
if one_or_more_forms_are_missing then
str = str .. "]"
end
if basic_form_is_not_given then
str = str .. "]"
end
return str
end
return export