Module: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

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="wikitable inflection-table inflection-table-la" ! class="corner-header" | Case ! class="number-header" | Singular ! class="case-header" | Nominative ! class="case-header" | Genitive ! class="case-header" | Dative ! class="case-header" | Accusative ! class="case-header" | Ablative ! class="case-header" | Vocative if data.forms.loc_sg then output:insert [=[
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * -]=]

! class="case-header" | Locative end output:insert('\n|}') if data.footnotes and data.footnotes ~= "" then output:insert('\n' .. data.footnotes) end
 * class="form-cell" | ]=]

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

function export.make_table_pl(data) local output = Array(data.title, stylesheet) output:insert [=[

{| class="wikitable inflection-table inflection-table-la" ! class="corner-header" | Case ! class="number-header" | Plural ! class="case-header" | Nominative ! class="case-header" | Genitive ! class="case-header" | Dative ! class="case-header" | Accusative ! class="case-header" | Ablative ! class="case-header" | Vocative ]=]	if data.forms.loc_pl then output:insert [=[
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |

! class="case-header" | Locative end output:insert('\n|}') if data.footnotes and data.footnotes ~= "" then output:insert('\n' .. data.footnotes) end return add_forms(output:concat, data.forms) end
 * class="form-cell" | ]=]

function export.make_table(data) local output = Array(data.title, stylesheet) output:insert [=[

{| class="wikitable inflection-table inflection-table-la" ! class="corner-header" | Case ! class="number-header" | Singular ! class="number-header" | Plural ! class="case-header" | Nominative ! class="case-header" | Genitive ! class="case-header" | Dative ! class="case-header" | Accusative ! class="case-header" | Ablative ! class="case-header" | Vocative if data.forms.loc_sg or data.forms.loc_pl then output:insert [=[
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * -]=]

! class="case-header" | Locative end output:insert('\n|}') if data.footnotes and data.footnotes ~= "" then output:insert('\n' .. data.footnotes) end return add_forms(output:concat, data.forms) end
 * class="form-cell" |
 * class="form-cell" | ]=]

return export