Modul:la-noun/table
A modult a Modul:la-noun/table/doc lapon tudod dokumentálni
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
local stylesheet = require("Module:TemplateStyles")("Template:la-decl-1st/style.css")
function export.make_table_sg(data)
local output = Array(data.title, stylesheet)
output:insert [=[
{| class="prettytable inflection-table inflection-table-la"
|-
! class="corner-header" | Eset
! class="number-header" | Singularis
|-
! class="case-header" | [[alanyeset|Nominativus]]
| class="form-cell" | {{{nom_sg}}}
|-
! class="case-header" | [[tárgyeset|Accusativus]]
| class="form-cell" | {{{acc_sg}}}
|-
! class="case-header" | [[birtokos eset|Genitivus]]
| class="form-cell" | {{{gen_sg}}}
|-
! class="case-header" | [[részes eset|Dativus]]
| class="form-cell" | {{{dat_sg}}}
|-
! class="case-header" | [[ablativus|Ablativus]]
| class="form-cell" | {{{abl_sg}}}
|-
! class="case-header" | [[vocativus|Vocativus]]
| class="form-cell" | {{{voc_sg}}}
|-]=]
if data.forms.loc_sg then
output:insert [=[
! class="case-header" | [[locativus|Locativus]]
| class="form-cell" | {{{loc_sg}}}]=]
end
output:insert('\n|}' .. data.footnote)
return add_forms(output:concat(), data.forms)
end
function export.make_table_pl(data)
local output = Array(data.title, stylesheet)
output:insert [=[
{| class="prettytable inflection-table inflection-table-la"
|-
! class="corner-header" | Eset
! class="number-header" | Pluralis
|-
! class="case-header" | [[alanyeset|Nominativus]]
| class="form-cell" | {{{nom_pl}}}
|-
! class="case-header" | [[tárgyeset|Accusativus]]
| class="form-cell" | {{{acc_pl}}}
|-
! class="case-header" | [[birtokos eset|Genitivus]]
| class="form-cell" | {{{gen_pl}}}
|-
! class="case-header" | [[részes eset|Dativus]]
| class="form-cell" | {{{dat_pl}}}
|-
! class="case-header" | [[ablativus|Ablativus]]
| class="form-cell" | {{{abl_pl}}}
|-
! class="case-header" | [[vocativus|Vocativus]]
| class="form-cell" | {{{voc_pl}}}
|-
]=]
if data.forms.loc_pl then
output:insert [=[
! class="case-header" | [[locativus|Locativus]]
| class="form-cell" | {{{loc_pl}}}]=]
end
output:insert('\n|}' .. data.footnote)
return add_forms(output:concat(), data.forms)
end
function export.make_table(data)
local output = Array(data.title, stylesheet)
output:insert [=[
{| class="prettytable inflection-table inflection-table-la"
|-
! class="corner-header" | Eset
! class="number-header" | Singularis
! class="number-header" | Pluralis
|-
! class="case-header" | [[alanyeset|Nominativus]]
| class="form-cell" | {{{nom_sg}}}
| class="form-cell" | {{{nom_pl}}}
|-
! class="case-header" | [[tárgyeset|Accusativus]]
| class="form-cell" | {{{acc_sg}}}
| class="form-cell" | {{{acc_pl}}}
|-
! class="case-header" | [[birtokos eset|Genitivus]]
| class="form-cell" | {{{gen_sg}}}
| class="form-cell" | {{{gen_pl}}}
|-
! class="case-header" | [[részes eset|Dativus]]
| class="form-cell" | {{{dat_sg}}}
| class="form-cell" | {{{dat_pl}}}
|-
! class="case-header" | [[ablativus|Ablativus]]
| class="form-cell" | {{{abl_sg}}}
| class="form-cell" | {{{abl_pl}}}
|-
! class="case-header" | [[vocativus|Vocativus]]
| class="form-cell" | {{{voc_sg}}}
| class="form-cell" | {{{voc_pl}}}
|-]=]
if data.forms.loc_sg or data.forms.loc_pl then
output:insert [=[
! class="case-header" | [[locativus|Locativus]]
| class="form-cell" | {{{loc_sg}}}
| class="form-cell" | {{{loc_pl}}}]=]
end
output:insert('\n|}' .. data.footnote)
return add_forms(output:concat(), data.forms)
end
return export