local lang = require("Module:languages").getByCode("bdk")
local export = {}
function export.manual(frame)
local params = {
["abs_s"] = {list = true},
["erg_s"] = {list = true},
["gen_I_s"] = {list = true},
["gen_II_s"] = {list = true},
["dat_s"] = {list = true},
["ins_s"] = {list = true},
["loc_I_s"] = {list = true},
["abl_I_s"] = {list = true},
["loc_II_s"] = {list = true},
["abl_II_s"] = {list = true},
["loc_III_s"] = {list = true},
["abl_III_s"] = {list = true},
["abl_IV_s"] = {list = true},
["abs_p"] = {list = true},
["erg_p"] = {list = true},
["gen_I_p"] = {list = true},
["gen_II_p"] = {list = true},
["dat_p"] = {list = true},
["ins_p"] = {list = true},
["loc_I_p"] = {list = true},
["abl_I_p"] = {list = true},
["loc_II_p"] = {list = true},
["abl_II_p"] = {list = true},
["loc_III_p"] = {list = true},
["abl_III_p"] = {list = true},
["abl_IV_p"] = {list = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {
forms = {},
info = "",
categories = {},
}
for param in pairs(params) do
if args[param][1] then
data.forms[(param:gsub("_", "|"))] = args[param]
end
end
return make_table(data)
end
-- Make the table
function make_table(data)
local function repl(param)
local accel = true
local no_store = false
if param == "info" then
return mw.getContentLanguage():ucfirst(data.info or "")
elseif string.sub(param, 1, 1) == "!" then
no_store = true
param = string.sub(param, 2)
elseif string.sub(param, 1, 1) == "#" then
accel = false
param = string.sub(param, 2)
end
local forms = data.forms[param]
if not forms or not forms[1] then
return "—"
end
local ret = {}
for key, subform in ipairs(forms) do
table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, no_store = no_store} or nil}))
end
return table.concat(ret, "<br/>")
end
local wikicode = [=[
{| class="inflection-table wikitable vsSwitcher" data-toggle-category="inflection"
|- style="text-align: left;"
! class="vsToggleElement" colspan="3" | {{{info}}}
|- class="vsShow"
! style="width: 9em;" | 絕對格單數
| style="width: 15em;" colspan="2" | {{{!abs|s}}}
|- class="vsShow"
! 作格單數
| colspan="2" | {{{!erg|s}}}
|- class="vsShow"
! 絕對格複數
| colspan="2" | {{{!abs|p}}}
|- class="vsHide"
! style="width: 9em;" |
! style="width: 12em;" | 單數
! style="width: 12em;" | 複數
|- class="vsHide"
! 絕對格
| data-accel-col="1" | {{{abs|s}}}
| data-accel-col="2" | {{{abs|p}}}
|- class="vsHide"
! 作格
| data-accel-col="1" | {{{erg|s}}}
| data-accel-col="2" | {{{erg|p}}}
|- class="vsHide"
! 屬格 I
| data-accel-col="1" | {{{gen|I|s}}}
| data-accel-col="2" | {{{gen|I|p}}}
|- class="vsHide"
! 屬格 II
| data-accel-col="1" | {{{gen|II|s}}}
| data-accel-col="2" | {{{gen|II|p}}}
|- class="vsHide"
! 與格
| data-accel-col="1" | {{{dat|s}}}
| data-accel-col="2" | {{{dat|p}}}
|- class="vsHide"
! 工具格
| data-accel-col="1" | {{{ins|s}}}
| data-accel-col="2" | {{{ins|p}}}
|- class="vsHide"
! 方位格 I
| data-accel-col="1" | {{{loc|I|s}}}
| data-accel-col="2" | {{{loc|I|p}}}
|- class="vsHide"
! 奪格 I
| data-accel-col="1" | {{{abl|I|s}}}
| data-accel-col="2" | {{{abl|I|p}}}
|- class="vsHide"
! 方位格 II
| data-accel-col="1" | {{{loc|II|s}}}
| data-accel-col="2" | {{{loc|II|p}}}
|- class="vsHide"
! 奪格 II
| data-accel-col="1" | {{{abl|II|s}}}
| data-accel-col="2" | {{{abl|II|p}}}
|- class="vsHide"
! 方位格 III
| data-accel-col="1" | {{{loc|III|s}}}
| data-accel-col="2" | {{{loc|III|p}}}
|- class="vsHide"
! 奪格 III
| data-accel-col="1" | {{{abl|III|s}}}
| data-accel-col="2" | {{{abl|III|p}}}
|- class="vsHide"
! 奪格 IV
| data-accel-col="1" | {{{abl|IV|s}}}
| data-accel-col="2" | {{{abl|IV|p}}}
|}]=]
return mw.ustring.gsub(wikicode, "{{{([^{}]+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end
return export