Module:la-noun/table

Definition from Wiktionary, the free dictionary
Jump to navigation Jump to search
Text-x-generic with pencil.svg This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

function export.make_table_sg(data)
	local output = {data.title}
	table.insert(output, '\n{| class="prettytable inflection-table inflection-table-la"')
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#549EA0; font-style:italic;" | Case')
	table.insert(output, '\n! style="background:#549EA0; font-style:italic;" | Singular')
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[nominative case|nominative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.nom_sg)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[genitive case|genitive]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.gen_sg)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[dative case|dative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.dat_sg)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[accusative case|accusative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.acc_sg)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[ablative case|ablative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.abl_sg)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[vocative case|vocative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.voc_sg)
	table.insert(output, '\n|-')
	if data.forms.loc_sg then
		table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" |  [[locative case|locative]]')
		table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.loc_sg)
	end
	table.insert(output, '\n|}' .. data.footnote)
	
	return table.concat(output)
end

function export.make_table_pl(data)
	local output = {data.title}
	table.insert(output, '\n{| class="prettytable inflection-table inflection-table-la"')
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#549EA0; font-style:italic;" | Case')
	table.insert(output, '\n! style="background:#549EA0; font-style:italic;" | Plural')
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[nominative case|nominative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.nom_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[genitive case|genitive]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.gen_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[dative case|dative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.dat_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[accusative case|accusative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.acc_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[ablative case|ablative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.abl_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[vocative case|vocative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.voc_pl)
	table.insert(output, '\n|-')
	if data.forms.loc_pl then
		table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" |  [[locative case|locative]]')
		table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.loc_pl)
	end
	table.insert(output, '\n|}' .. data.footnote)
	
	return table.concat(output)
end

function export.make_table(data)
	local output = {data.title}
	table.insert(output, '\n{| class="prettytable inflection-table inflection-table-la"')
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#549EA0; font-style:italic;" | Case')
	table.insert(output, '\n! style="background:#549EA0; font-style:italic;" | Singular')
	table.insert(output, '\n! style="background:#549EA0; font-style:italic;" | Plural')
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[nominative case|nominative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.nom_sg)
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.nom_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[genitive case|genitive]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.gen_sg)
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.gen_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[dative case|dative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.dat_sg)
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.dat_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[accusative case|accusative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.acc_sg)
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.acc_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[ablative case|ablative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.abl_sg)
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.abl_pl)
	table.insert(output, '\n|-')
	table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" | [[vocative case|vocative]]')
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.voc_sg)
	table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.voc_pl)
	table.insert(output, '\n|-')
	if data.forms.loc_sg or data.forms.loc_pl then
		table.insert(output, '\n! style="background:#40E0D0; font-style:italic;" |  [[locative case|locative]]')
		table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.loc_sg)
		table.insert(output, '\n| style="background:#F8F8FF;" | ' .. data.forms.loc_pl)
	end
	table.insert(output, '\n|}' .. data.footnote)
	
	return table.concat(output)
end

return export