বিষয়বস্তুতে চলুন

মডিউল:la-noun/table

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:la-noun/table/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

local export = {}

local Array = require 'Module:array'

local function add_forms(wikitable, forms)
	if type(wikitable) ~= 'string' then
		error('Expected string, got ' .. type(wikitable))
	end
	
	wikitable = wikitable:gsub('{{{([^}]+)}}}', forms)
	return wikitable
end

function export.make_table_sg(data)
	local output = Array(data.title, mw.getCurrentFrame():expandTemplate{
		title = 'inflection-table-top',
		args = {
			title = '-',
			palette = 'cyan',
			class = 'sticky-left-column',
			lang = "la",
		}
	})
	output:insert [=[
! class="outer" |
! class="outer" | singular
|-
! [[nominative case|nominative]]
| {{{nom_sg}}}
|-
! [[genitive case|genitive]]
| {{{gen_sg}}}
|-
! [[dative case|dative]]
| {{{dat_sg}}}
|-
! [[accusative case|accusative]]
| {{{acc_sg}}}
|-
! [[ablative case|ablative]]
| {{{abl_sg}}}
|-
! [[vocative case|vocative]]
| {{{voc_sg}}}
|-]=]
	if data.forms.loc_sg then
		output:insert [=[

! [[locative case|locative]]
| {{{loc_sg}}}]=]
	end
	output:insert('\n')
	output:insert(mw.getCurrentFrame():expandTemplate{ title = 'inflection-table-bottom' })
	if data.footnotes and data.footnotes ~= '' then
		output:insert('\n' .. data.footnotes)
	end

	return add_forms(output:concat(), data.forms)
end

function export.make_table_pl(data)
	local output = Array(data.title, mw.getCurrentFrame():expandTemplate{
		title = 'inflection-table-top',
		args = {
			title = '-',
			palette = 'cyan',
			class = 'sticky-left-column',
			lang = "la",
		}
	})
	output:insert [=[
! class="outer" |
! class="outer" | plural
|-
! [[nominative case|nominative]]
| {{{nom_pl}}}
|-
! [[genitive case|genitive]]
| {{{gen_pl}}}
|-
! [[dative case|dative]]
| {{{dat_pl}}}
|-
! [[accusative case|accusative]]
| {{{acc_pl}}}
|-
! [[ablative case|ablative]]
| {{{abl_pl}}}
|-
! [[vocative case|vocative]]
| {{{voc_pl}}}
|-
]=]
	if data.forms.loc_pl then
		output:insert [=[

! [[locative case|locative]]
| {{{loc_pl}}}]=]
	end
	output:insert('\n')
	output:insert(mw.getCurrentFrame():expandTemplate{ title = 'inflection-table-bottom' })
	if data.footnotes and data.footnotes ~= '' then
		output:insert('\n' .. data.footnotes)
	end
	
	return add_forms(output:concat(), data.forms)
end

function export.make_table(data)
	local output = Array(data.title, mw.getCurrentFrame():expandTemplate{
		title = 'inflection-table-top',
		args = {
			title = '-',
			palette = 'cyan',
			class = 'sticky-left-column',
			lang = "la",
		}
	})
	output:insert [=[
! class="outer" |
! class="outer" | singular
! class="outer" | plural
|-
! [[nominative case|nominative]]
| {{{nom_sg}}}
| {{{nom_pl}}}
|-
! [[genitive case|genitive]]
| {{{gen_sg}}}
| {{{gen_pl}}}
|-
! [[dative case|dative]]
| {{{dat_sg}}}
| {{{dat_pl}}}
|-
! [[accusative case|accusative]]
| {{{acc_sg}}}
| {{{acc_pl}}}
|-
! [[ablative case|ablative]]
| {{{abl_sg}}}
| {{{abl_pl}}}
|-
! [[vocative case|vocative]]
| {{{voc_sg}}}
| {{{voc_pl}}}
|-]=]
	if data.forms.loc_sg or data.forms.loc_pl then
		output:insert [=[

! [[locative case|locative]]
| {{{loc_sg}}}
| {{{loc_pl}}}]=]
	end
	output:insert('\n')
	output:insert(mw.getCurrentFrame():expandTemplate{ title = 'inflection-table-bottom' })
	if data.footnotes and data.footnotes ~= '' then
		output:insert('\n' .. data.footnotes)
	end
	
	return add_forms(output:concat(), data.forms)
end

return export