Modul:la-noun/table
Penampilan
- Laman modul ini kekurangan sublaman pendokumenan. Sila cipta laman pendokumenan tersebut.
- Pautan berguna: akar laman • sublaman akar laman • pautan • transklusi • kes ujian • kotak pasir
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', lang = 'la' } })
output:insert [=[
!
! tunggal
|-
! nominatif
| {{{nom_sg}}}
|-
! genitif
| {{{gen_sg}}}
|-
! datif
| {{{dat_sg}}}
|-
! akusatif
| {{{acc_sg}}}
|-
! ablatif
| {{{abl_sg}}}
|-
! vokatif
| {{{voc_sg}}}
|-]=]
if data.forms.loc_sg then
output:insert [=[
! lokatif
| {{{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', lang = 'la' } })
output:insert [=[
!
! jamak
|-
! nominatif
| {{{nom_pl}}}
|-
! genitif
| {{{gen_pl}}}
|-
! datif
| {{{dat_pl}}}
|-
! akusatif
| {{{acc_pl}}}
|-
! ablatif
| {{{abl_pl}}}
|-
! vokatif
| {{{voc_pl}}}
|-
]=]
if data.forms.loc_pl then
output:insert [=[
! lokatif
| {{{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', lang = 'la' } })
output:insert [=[
!
! tunggal
! jamak
|-
! nominatif
| {{{nom_sg}}}
| {{{nom_pl}}}
|-
! genitif
| {{{gen_sg}}}
| {{{gen_pl}}}
|-
! datif
| {{{dat_sg}}}
| {{{dat_pl}}}
|-
! akusatif
| {{{acc_sg}}}
| {{{acc_pl}}}
|-
! ablatif
| {{{abl_sg}}}
| {{{abl_pl}}}
|-
! vokatif
| {{{voc_sg}}}
| {{{voc_pl}}}
|-]=]
if data.forms.loc_sg or data.forms.loc_pl then
output:insert [=[
! lokatif
| {{{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