Module:av-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:av-decl-1st/style.css")

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

{| class="wikitable inflection-table inflection-table-av" ! class="corner-header" | Case ! class="number-header" | Singular ! class="case-header" | Absolutive ! class="case-header" | Ergative ! class="case-header" | Genitive ! class="case-header" | Dative ! class="case-header" | Instrumental output:insert('\n|}') if data.footnotes and data.footnotes ~= "" then output:insert('\n' .. data.footnotes) end
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * 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-av" ! class="corner-header" | Case ! class="number-header" | Plural ! class="case-header" | Absolutive ! class="case-header" | Ergative ! class="case-header" | Genitive ! class="case-header" | Dative ! class="case-header" | Instrumental 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" |
 * class="form-cell" |
 * class="form-cell" |
 * 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" | Absolutive ! class="case-header" | Ergative ! class="case-header" | Genitive ! class="case-header" | Dative ! class="case-header" | Instrumental 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" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * class="form-cell" |
 * -]=]

return export