Bu modul uchun Modul:la-adj/table/doc nomli hujjat sahifasini yaratishingiz mumkin

local export = {}

local function make_table_mf_pl(data)
	local output = data.title
	output = output .. '\n{| class="prettytable inflection-table"'
	output = output .. '\n!style="background:#549EA0; font-style:italic;"| Raqamr'
	output = output .. '\n!style="background:#549EA0; font-style:italic;" colspan="2" | Koʻplik'
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| 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; font-style:italic;"| [[nominative case|nominative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[genitive case|genitive]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[dative case|dative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[accusative case|accusative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[ablative case|ablative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_n
	output = output .. '\n|-'
	if data.voc then
		output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[vocative case|vocative]]'
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_m
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_n
	end
	output = output .. '\n|}'
	output = output .. '\n' .. data.footnote
	
	return output
end

local function make_table_pl(data)
	local output = data.title
	output = output .. '\n{| class="prettytable inflection-table"'
	output = output .. '\n!style="background:#549EA0; font-style:italic;"| Raqam'
	output = output .. '\n!style="background:#549EA0; font-style:italic;" colspan="3" | Koʻplik'
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| 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; font-style:italic;"| [[nominative case|nominative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[genitive case|genitive]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[dative case|dative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[accusative case|accusative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[ablative case|ablative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_n
	output = output .. '\n|-'
	if data.voc then
		output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[vocative case|vocative]]'
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_m
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_f
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_n
	end
	output = output .. '\n|}'
	output = output .. '\n' .. data.footnote
	
	return output
end

local function make_table_mf(data)
	local output = data.title
	output = output .. '\n{| class="prettytable inflection-table"'
	output = output .. '\n!style="background:#549EA0; font-style:italic;"| Raqam'
	output = output .. '\n!style="background:#549EA0; font-style:italic;" colspan="2" | Birlik'
	output = output .. '\n|rowspan="2"|'
	output = output .. '\n!style="background:#549EA0; font-style:italic;" colspan="2" | Koʻplik'
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| 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; font-style:italic;"| [[nominative case|nominative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_sg_n
	if data.voc then
		output = output .. '\n|rowspan="6"|'
	else
		output = output .. '\n|rowspan="5"|'
	end
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[genitive case|genitive]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[dative case|dative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[accusative case|accusative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[ablative case|ablative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_n
	output = output .. '\n|-'
	if data.voc then
		output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[vocative case|vocative]]'
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_sg_m
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_sg_n
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_m
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_n
	end
	output = output .. '\n|}'
	output = output .. '\n' .. data.footnote
	
	return output
end

function export.make_table(data)
	if not data.forms.nom_sg_f then
		if data.subtype:find("pl") then return make_table_mf_pl(data)
		else return make_table_mf(data) end
	else
		if data.subtype:find("pl") then return make_table_pl(data) end
	end
	
	local output = data.title
	output = output .. '\n{| class="prettytable inflection-table"'
	output = output .. '\n!style="background:#549EA0; font-style:italic;"| Raqam'
	output = output .. '\n!style="background:#549EA0; font-style:italic;" colspan="3" | Birlik'
	output = output .. '\n|rowspan="2"|'
	output = output .. '\n!style="background:#549EA0; font-style:italic;" colspan="3" | Koʻplik'
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| 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; font-style:italic;"| [[nominative case|nominative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_sg_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_sg_n
	if data.voc then
		output = output .. '\n|rowspan="6"|'
	else
		output = output .. '\n|rowspan="5"|'
	end
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.nom_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[genitive case|genitive]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_sg_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.gen_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[dative case|dative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_sg_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.dat_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[accusative case|accusative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_sg_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.acc_pl_n
	output = output .. '\n|-'
	output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[ablative case|ablative]]'
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_sg_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_sg_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_sg_n
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_m
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_f
	output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.abl_pl_n
	output = output .. '\n|-'
	if data.voc then
		output = output .. '\n!style="background:#40E0D0; font-style:italic;"| [[vocative case|vocative]]'
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_sg_m
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_sg_f
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_sg_n
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_m
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_f
		output = output .. '\n|style="background:#F8F8FF;"| ' .. data.forms.voc_pl_n
	end
	output = output .. '\n|}'
	output = output .. '\n' .. data.footnote
	
	return output
end

return export