Mô đun:la-noun/table
Giao diện
- Trang mô đun này thiếu trang con tài liệu. Xin hãy tạo trang tài liệu này.
- Liên kết hữu ích: trang gốc • trang con của trang gốc • liên kết • nhúng • trường hợp kiểm thử • chỗ thử
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 = 'purple',
class = 'sticky-left-column',
lang = "la",
}
})
output:insert [=[
! class="outer" |
! class="outer" | số ít
|-
! [[nominative|danh cách]]
| {{{nom_sg}}}
|-
! [[genitive|sinh cách]]
| {{{gen_sg}}}
|-
! [[dative|dữ cách]]
| {{{dat_sg}}}
|-
! [[accusative|đối cách]]
| {{{acc_sg}}}
|-
! [[ablative|ly cách]]
| {{{abl_sg}}}
|-
! [[vocative|hô cách]]
| {{{voc_sg}}}
|-]=]
if data.forms.loc_sg then
output:insert [=[
! [[locative|định vị cách]]
| {{{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 = 'purple',
class = 'sticky-left-column',
lang = "la",
}
})
output:insert [=[
! class="outer" |
! class="outer" | số nhiều
|-
! [[nominative|danh cách]]
| {{{nom_pl}}}
|-
! [[genitive|sinh cách]]
| {{{gen_pl}}}
|-
! [[dative|dữ cách]]
| {{{dat_pl}}}
|-
! [[accusative|đối cách]]
| {{{acc_pl}}}
|-
! [[ablative|ly cách]]
| {{{abl_pl}}}
|-
! [[vocative|hô cách]]
| {{{voc_pl}}}
|-
]=]
if data.forms.loc_pl then
output:insert [=[
! [[locative|định vị cách]]
| {{{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 = 'purple',
class = 'sticky-left-column',
lang = "la",
}
})
output:insert [=[
! class="outer" |
! class="outer" | số ít
! class="outer" | số nhiều
|-
! [[nominative|danh cách]]
| {{{nom_sg}}}
| {{{nom_pl}}}
|-
! [[genitive|sinh cách]]
| {{{gen_sg}}}
| {{{gen_pl}}}
|-
! [[dative|dữ cách]]
| {{{dat_sg}}}
| {{{dat_pl}}}
|-
! [[accusative|đối cách]]
| {{{acc_sg}}}
| {{{acc_pl}}}
|-
! [[ablative|ly cách]]
| {{{abl_sg}}}
| {{{abl_pl}}}
|-
! [[vocative|hô cách]]
| {{{voc_sg}}}
| {{{voc_pl}}}
|-]=]
if data.forms.loc_sg or data.forms.loc_pl then
output:insert [=[
! [[locative|định vị cách]]
| {{{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