মডিউল:la-adj/table
অবয়ব
এই মডিউলের জন্য মডিউল:la-adj/table/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
local export = {}
local m_table = require("Module:table")
local function convert(data, conv)
local col = {}
local row = {}
local colors = {}
local marked = {}
local slots = {}
local function add(i,j)
local col = col[i][j]
local row = row[i][j]
local color = colors[i][j]
if col==0 or row==0 then
return ""
end
local entry = data.finish_show_form(data, slots[i][j])
if col==1 then
if row==1 then
return '\n|style="background:#' .. color .. ';" align=center | ' .. entry
else
return '\n|style="background:#' .. color .. ';" align=center rowspan=' .. row .. ' | ' .. entry
end
else
if row==1 then
return '\n|style="background:#' .. color .. ';" align=center colspan=' .. col .. ' | ' .. entry
else
return '\n|style="background:#' .. color .. ';" align=center colspan=' .. col .. ' rowspan=' .. row .. ' | ' .. entry
end
end
end
for i=1,#conv do
col[i] = {}
row[i] = {}
colors[i] = {}
marked[i] = {}
slots[i] = {}
for j=1,#conv[i] do
col[i][j] = 1
row[i][j] = 1
colors[i][j] = "F8F8FF"
marked[i][j] = false
slots[i][j] = {conv[i][j]}
end
end
-- Return true if the contents of the two slots are equal in every
-- way. This means the forms are the same, the footnote text is the
-- same, and the accelerator lemmas are the same. We need to compare
-- the accelerator lemmas because in some cases different slots have
-- different lemmas (e.g. when noneut=1 is set, the masculine slots
-- will have the masculine lemma but the feminine slots will have the
-- feminine lemma).
local function slots_equal(slot1, slot2)
return m_table.deepEquals(data.forms[slot1], data.forms[slot2]) and
m_table.deepEquals(data.notetext[slot1], data.notetext[slot2]) and
(data.accel[slot1] and data.accel[slot1].lemma or nil) ==
(data.accel[slot2] and data.accel[slot2].lemma or nil)
end
--merge rows
for i=1,#conv do for j=1,#conv[i] do
if col[i][j] ~= 0 then
for k=j+1,#conv[i] do
local slotij = conv[i][j]
local slotik = conv[i][k]
if not slots_equal(slotij, slotik) then
break
end
col[i][j] = col[i][j] + 1
col[i][k] = 0
row[i][k] = 0
for _, slot in ipairs(slots[i][k]) do
table.insert(slots[i][j], slot)
end
slots[i][k] = nil
end
end
end end
--merge columns
for i=1,#conv do
for j=1,#conv[i] do
if row[i][j] ~= 0 then
for k=i+1,#conv do
local slotij = conv[i][j]
local slotkj = conv[k][j]
if not slots_equal(slotij, slotkj) or col[i][j] ~= col[k][j] then
break
end
row[i][j] = row[i][j] + 1
row[k][j] = 0
for _, slot in ipairs(slots[k][j]) do
table.insert(slots[i][j], slot)
end
slots[k][j] = nil
end
end
end
end
--final
for i=1,#conv do
for j=1,#conv[i] do
conv[i][j] = add(i,j)
end
conv[i] = table.concat(conv[i])
end
return conv
end
local function make_table_mfn_pl(data, noneut)
local conv = {
{"nom_pl_m"},
{"gen_pl_m"},
{"dat_pl_m"},
{"acc_pl_m"},
{"abl_pl_m"},
{"voc_pl_m"},
{"loc_pl_m"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; "| Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| ' .. (noneut and 'Masc./Fem.' or 'Masc./Fem./Neut.')
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_mfn_sg(data, noneut)
local conv = {
{"nom_sg_m"},
{"gen_sg_m"},
{"dat_sg_m"},
{"acc_sg_m"},
{"abl_sg_m"},
{"voc_sg_m"},
{"loc_sg_m"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; "| Singular'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| ' .. (noneut and 'Masc./Fem.' or 'Masc./Fem./Neut.')
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_n_pl(data)
local conv = {
{"nom_pl_n"},
{"gen_pl_n"},
{"dat_pl_n"},
{"acc_pl_n"},
{"abl_pl_n"},
{"voc_pl_n"},
{"loc_pl_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; "| Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| ' .. 'Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_n_sg(data)
local conv = {
{"nom_sg_n"},
{"gen_sg_n"},
{"dat_sg_n"},
{"acc_sg_n"},
{"abl_sg_n"},
{"voc_sg_n"},
{"loc_sg_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; "| Singular'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| ' .. 'Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_mf_and_n_pl(data)
local conv = {
{"nom_pl_m", "nom_pl_n"},
{"gen_pl_m", "gen_pl_n"},
{"dat_pl_m", "dat_pl_n"},
{"acc_pl_m", "acc_pl_n"},
{"abl_pl_m", "abl_pl_n"},
{"voc_pl_m", "voc_pl_n"},
{"loc_pl_m", "loc_pl_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masc./Fem.'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_mf_and_n_sg(data)
local conv = {
{"nom_sg_m", "nom_sg_n"},
{"gen_sg_m", "gen_sg_n"},
{"dat_sg_m", "dat_sg_n"},
{"acc_sg_m", "acc_sg_n"},
{"abl_sg_m", "abl_sg_n"},
{"voc_sg_m", "voc_sg_n"},
{"loc_sg_m", "loc_sg_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Singular'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masc./Fem.'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_m_and_f_pl(data)
local conv = {
{"nom_pl_m", "nom_pl_f"},
{"gen_pl_m", "gen_pl_f"},
{"dat_pl_m", "dat_pl_f"},
{"acc_pl_m", "acc_pl_f"},
{"abl_pl_m", "abl_pl_f"},
{"voc_pl_m", "voc_pl_f"},
{"loc_pl_m", "loc_pl_f"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_m_and_f_sg(data)
local conv = {
{"nom_sg_m", "nom_sg_f"},
{"gen_sg_m", "gen_sg_f"},
{"dat_sg_m", "dat_sg_f"},
{"acc_sg_m", "acc_sg_f"},
{"abl_sg_m", "abl_sg_f"},
{"voc_sg_m", "voc_sg_f"},
{"loc_sg_m", "loc_sg_f"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Singular'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_m_and_f_and_n_pl(data)
local conv = {
{"nom_pl_m", "nom_pl_f", "nom_pl_n"},
{"gen_pl_m", "gen_pl_f", "gen_pl_n"},
{"dat_pl_m", "dat_pl_f", "dat_pl_n"},
{"acc_pl_m", "acc_pl_f", "acc_pl_n"},
{"abl_pl_m", "abl_pl_f", "abl_pl_n"},
{"voc_pl_m", "voc_pl_f", "voc_pl_n"},
{"loc_pl_m", "loc_pl_f", "loc_pl_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="3" | Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_m_and_f_and_n_sg(data)
local conv = {
{"nom_sg_m", "nom_sg_f", "nom_sg_n"},
{"gen_sg_m", "gen_sg_f", "gen_sg_n"},
{"dat_sg_m", "dat_sg_f", "dat_sg_n"},
{"acc_sg_m", "acc_sg_f", "acc_sg_n"},
{"abl_sg_m", "abl_sg_f", "abl_sg_n"},
{"voc_sg_m", "voc_sg_f", "voc_sg_n"},
{"loc_sg_m", "loc_sg_f", "loc_sg_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="3" | Singular'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
end
output = output .. '\n|}'
return output
end
local function make_table_mfn(data, noneut)
local conv = {
{"nom_sg_m"},
{"gen_sg_m"},
{"dat_sg_m"},
{"acc_sg_m"},
{"abl_sg_m"},
{"voc_sg_m"},
{"loc_sg_m"},
{"----"}, -- prevents merge rows from merging cells at the bottom of sg with cells at the top of pl
{"nom_pl_m"},
{"gen_pl_m"},
{"dat_pl_m"},
{"acc_pl_m"},
{"abl_pl_m"},
{"voc_pl_m"},
{"loc_pl_m"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; "| Singular'
output = output .. '\n|rowspan="2"|'
output = output .. '\n!style="background:#549EA0; "| Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| ' .. (noneut and 'Masc./Fem.' or 'Masc./Fem./Neut.')
output = output .. '\n!style="background:#40E0D0;"| ' .. (noneut and 'Masc./Fem.' or 'Masc./Fem./Neut.')
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
if data.voc and data.loc then
output = output .. '\n|rowspan="7"|'
elseif data.voc or data.loc then
output = output .. '\n|rowspan="6"|'
else
output = output .. '\n|rowspan="5"|'
end
output = output .. conv[9]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. conv[10]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. conv[11]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. conv[12]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
output = output .. conv[13]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
output = output .. conv[14]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
output = output .. conv[15]
end
output = output .. '\n|}'
return output
end
local function make_table_n(data)
local conv = {
{"nom_sg_n"},
{"gen_sg_n"},
{"dat_sg_n"},
{"acc_sg_n"},
{"abl_sg_n"},
{"voc_sg_n"},
{"loc_sg_n"},
{"----"}, -- prevents merge rows from merging cells at the bottom of sg with cells at the top of pl
{"nom_pl_n"},
{"gen_pl_n"},
{"dat_pl_n"},
{"acc_pl_n"},
{"abl_pl_n"},
{"voc_pl_n"},
{"loc_pl_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; "| Singular'
output = output .. '\n|rowspan="2"|'
output = output .. '\n!style="background:#549EA0; "| Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| ' .. 'Neuter'
output = output .. '\n!style="background:#40E0D0;"| ' .. 'Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
if data.voc and data.loc then
output = output .. '\n|rowspan="7"|'
elseif data.voc or data.loc then
output = output .. '\n|rowspan="6"|'
else
output = output .. '\n|rowspan="5"|'
end
output = output .. conv[9]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. conv[10]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. conv[11]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. conv[12]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
output = output .. conv[13]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
output = output .. conv[14]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
output = output .. conv[15]
end
output = output .. '\n|}'
return output
end
local function make_table_mf_and_n(data)
local conv = {
{"nom_sg_m", "nom_sg_n"},
{"gen_sg_m", "gen_sg_n"},
{"dat_sg_m", "dat_sg_n"},
{"acc_sg_m", "acc_sg_n"},
{"abl_sg_m", "abl_sg_n"},
{"voc_sg_m", "voc_sg_n"},
{"loc_sg_m", "loc_sg_n"},
{"----", "----"}, -- prevents merge rows from merging cells at the bottom of sg with cells at the top of pl
{"nom_pl_m", "nom_pl_n"},
{"gen_pl_m", "gen_pl_n"},
{"dat_pl_m", "dat_pl_n"},
{"acc_pl_m", "acc_pl_n"},
{"abl_pl_m", "abl_pl_n"},
{"voc_pl_m", "voc_pl_n"},
{"loc_pl_m", "loc_pl_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Singular'
output = output .. '\n|rowspan="2"|'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masc./Fem.'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n!style="background:#40E0D0;"| Masc./Fem.'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
if data.voc and data.loc then
output = output .. '\n|rowspan="7"|'
elseif data.voc or data.loc then
output = output .. '\n|rowspan="6"|'
else
output = output .. '\n|rowspan="5"|'
end
output = output .. conv[9]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. conv[10]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. conv[11]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. conv[12]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
output = output .. conv[13]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
output = output .. conv[14]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
output = output .. conv[15]
end
output = output .. '\n|}'
return output
end
local function make_table_m_and_f(data)
local conv = {
{"nom_sg_m", "nom_sg_f"},
{"gen_sg_m", "gen_sg_f"},
{"dat_sg_m", "dat_sg_f"},
{"acc_sg_m", "acc_sg_f"},
{"abl_sg_m", "abl_sg_f"},
{"voc_sg_m", "voc_sg_f"},
{"loc_sg_m", "loc_sg_f"},
{"----", "----"}, -- prevents merge rows from merging cells at the bottom of sg with cells at the top of pl
{"nom_pl_m", "nom_pl_f"},
{"gen_pl_m", "gen_pl_f"},
{"dat_pl_m", "dat_pl_f"},
{"acc_pl_m", "acc_pl_f"},
{"abl_pl_m", "abl_pl_f"},
{"voc_pl_m", "voc_pl_f"},
{"loc_pl_m", "loc_pl_f"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Singular'
output = output .. '\n|rowspan="2"|'
output = output .. '\n!style="background:#549EA0; " colspan="2" | Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
if data.voc and data.loc then
output = output .. '\n|rowspan="7"|'
elseif data.voc or data.loc then
output = output .. '\n|rowspan="6"|'
else
output = output .. '\n|rowspan="5"|'
end
output = output .. conv[9]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. conv[10]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. conv[11]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. conv[12]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
output = output .. conv[13]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
output = output .. conv[14]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
output = output .. conv[15]
end
output = output .. '\n|}'
return output
end
local function make_table_m_and_f_and_n(data)
local conv = {
{"nom_sg_m", "nom_sg_f", "nom_sg_n"},
{"gen_sg_m", "gen_sg_f", "gen_sg_n"},
{"dat_sg_m", "dat_sg_f", "dat_sg_n"},
{"acc_sg_m", "acc_sg_f", "acc_sg_n"},
{"abl_sg_m", "abl_sg_f", "abl_sg_n"},
{"voc_sg_m", "voc_sg_f", "voc_sg_n"},
{"loc_sg_m", "loc_sg_f", "loc_sg_n"},
{"----", "----", "----"}, -- prevents merge rows from merging cells at the bottom of sg with cells at the top of pl
{"nom_pl_m", "nom_pl_f", "nom_pl_n"},
{"gen_pl_m", "gen_pl_f", "gen_pl_n"},
{"dat_pl_m", "dat_pl_f", "dat_pl_n"},
{"acc_pl_m", "acc_pl_f", "acc_pl_n"},
{"abl_pl_m", "abl_pl_f", "abl_pl_n"},
{"voc_pl_m", "voc_pl_f", "voc_pl_n"},
{"loc_pl_m", "loc_pl_f", "loc_pl_n"},
}
conv = convert(data, conv)
local output = data.title
output = output .. '\n{| class="prettytable inflection-table inflection-table-la"'
output = output .. '\n!style="background:#549EA0; "| Number'
output = output .. '\n!style="background:#549EA0; " colspan="3" | Singular'
output = output .. '\n|rowspan="2"|'
output = output .. '\n!style="background:#549EA0; " colspan="3" | Plural'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| Case / Gender'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n!style="background:#40E0D0;"| Masculine'
output = output .. '\n!style="background:#40E0D0;"| Feminine'
output = output .. '\n!style="background:#40E0D0;"| Neuter'
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[nominative case|Nominative]]'
output = output .. conv[1]
if data.voc and data.loc then
output = output .. '\n|rowspan="7"|'
elseif data.voc or data.loc then
output = output .. '\n|rowspan="6"|'
else
output = output .. '\n|rowspan="5"|'
end
output = output .. conv[9]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[সম্বন্ধ পদ|সম্বন্ধ পদ]]'
output = output .. conv[2]
output = output .. conv[10]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[dative case|Dative]]'
output = output .. conv[3]
output = output .. conv[11]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[accusative case|Accusative]]'
output = output .. conv[4]
output = output .. conv[12]
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[ablative case|Ablative]]'
output = output .. conv[5]
output = output .. conv[13]
if data.voc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[vocative case|Vocative]]'
output = output .. conv[6]
output = output .. conv[14]
end
if data.loc then
output = output .. '\n|-'
output = output .. '\n!style="background:#40E0D0; "| [[locative case|Locative]]'
output = output .. conv[7]
output = output .. conv[15]
end
output = output .. '\n|}'
return output
end
function export.make_table(data, noneut, nomf)
local output
if not data.forms.nom_sg_n and not data.forms.nom_pl_n then
if data.forms.nom_sg_f or data.forms.nom_pl_f then
if data.num == "pl" then output = make_table_m_and_f_pl(data)
elseif data.num == "sg" then output = make_table_m_and_f_sg(data)
else output = make_table_m_and_f(data) end
else
if data.num == "pl" then output = make_table_mfn_pl(data, noneut)
elseif data.num == "sg" then output = make_table_mfn_sg(data, noneut)
else output = make_table_mfn(data, noneut) end
end
elseif nomf then
if data.num == "pl" then output = make_table_n_pl(data)
elseif data.num == "sg" then output = make_table_n_sg(data)
else output = make_table_n(data, noneut) end
elseif not data.forms.nom_sg_f and not data.forms.nom_pl_f then
if data.num == "pl" then output = make_table_mf_and_n_pl(data)
elseif data.num == "sg" then output = make_table_mf_and_n_sg(data)
else output = make_table_mf_and_n(data) end
else
if data.num == "pl" then output = make_table_m_and_f_and_n_pl(data)
elseif data.num == "sg" then output = make_table_m_and_f_and_n_sg(data)
else output = make_table_m_and_f_and_n(data) end
end
if data.footnotes and data.footnotes ~= "" then
output = output .. '\n' .. data.footnotes
end
return output
end
return export
-- For Vim, so we get 4-space tabs
-- vim: set ts=4 sw=4 noet: