Module:akk-conj/table
Appearance
- This module lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
local export = {}
local common = require("Module:akk-common")
local links = require("Module:links")
local lang = require("Module:languages").getByCode("akk")
local NOTE =
"This table gives Old Babylonian inflection. For conjugation in other dialects, see [[Appendix:Akkadian dialectal conjugation]]."
local function column(cun, trans, i)
local number_gender
if cun.number[i][2] and cun.number[i][2] == "m" then
number_gender = '\n! rowspan="2" |' .. cun.number[i][1] .. '\n! class="secondary" rowspan="1" |' .. cun.number[i][2]
elseif cun.number[i][2] then
number_gender = '\n! class="secondary rowspan="1" |' .. cun.number[i][2]
else
number_gender = '\n! rowspan="1" colspan="2" |' .. cun.number[i][1]
end
return '\n|- ' .. number_gender ..
'\n| ' .. trans.dur[i] ..
'\n| ' .. trans.perf[i] ..
'\n| ' .. trans.pret[i] ..
'\n| ' .. trans.imp[i]
end
local function top(stem, cun, trans, title)
return mw.getCurrentFrame():expandTemplate {
title = 'inflection-table-top',
args = {
title = title,
palette = 'blue',
tall = 'yes'
}
} ..
'\n! rowspan="1" colspan="2" class= | Infinitive' ..
'\n| ' .. trans.inf .. '\n| rowspan="1" colspan="3" class="blank-end-row" | \n|-' .. '\n' ..
'\n! rowspan="1" colspan="2" | Participle' ..
'\n| ' .. trans.part .. '\n| rowspan="1" colspan="3" class="blank-end-row" | \n|-' .. '\n' ..
'\n! rowspan="1" colspan="2" | Adjective' ..
'\n| ' .. trans.adj .. '\n| rowspan="1" colspan="3" class="blank-end-row" | \n|-' .. '\n' ..
'\n|-\n| class="separator" colspan="999" | \n|-' .. '\n' ..
'\n! colspan="2" |Active' ..
'\n! Durative' ..
'\n! Perfect' ..
'\n! Preterite' ..
'\n! Imperative'
end
local function bottom()
return "\n" .. mw.getCurrentFrame():expandTemplate {
title = 'inflection-table-bottom',
args = {
notes = NOTE
}
}
end
function export.render_cuneiform(stem, cun, trans, title)
local template = top(stem, cun, trans, title or "Cuneiform")
for i, _ in ipairs(cun.number) do
template = template .. column(cun, trans, i)
end
template = template .. bottom()
return template
end
local function map_column(column, func)
local output = {}
for i, word in ipairs(column) do output[i] = func(word) end
return output
end
local function map_table(table, func)
local output = {
number = table.number,
dur = map_column(table.dur, func),
pret = map_column(table.pret, func),
perf = map_column(table.perf, func),
imp = map_column(table.imp, func),
inf = func(table.inf),
part = func(table.part),
adj = func(table.adj)
}
return output
end
export.map_table = map_table
function export.render_transcription(stem, trans)
local dummy = {}
local empty = { "", "", "", "", "", "", "", "" }
dummy.inf = ""
dummy.part = ""
dummy.adj = ""
dummy.dur = empty
dummy.pret = empty
dummy.perf = empty
dummy.imp = empty
return export.render_cuneiform(stem, trans, dummy, "Normalization")
end
function export.render(stem, trans, debug)
local italicize = function(word) return word end
local normalisations = map_table(trans, italicize)
local cun = trans
cun = map_table(cun, function(term)
if cun == "-" then return "" end
return links.full_link({ lang = lang, term = term })
end)
if debug then
return export.render_transcription(stem, normalisations)
else
return export.render_cuneiform(stem, cun, normalisations, "Conjugation")
end
end
return export