Module:qhv-adj: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 121: Line 121:
end
end


local function make_pre_cases(data)
local function make_cases(data, pre)
local cases = {"nominative", "accusative", "genitive", "dative", "locative", "instrumental", "comitative", "vocative"}
local cases = {"nominative", "accusative", "genitive", "dative", "locative", "instrumental", "comitative", "vocative"}
local genders = {"lunar", "solar", "terrestrial", "aquatic"}
local genders = {"lunar", "solar", "terrestrial", "aquatic"}
local ret = {}
local ret = {}
data.pre = true
for _, case in ipairs(cases) do
local case_short = sub(case, 1, 3)
table.insert(ret, "|- \n! ! style=\"background-color: #FFB976;\"|" .. case .. "\n")
for _, gender in ipairs(genders) do
local g_short = sub(gender, 1, 1)
for _, number in ipairs({"sg", "pl"}) do
table.insert(ret, "| " .. link(show_form(data.forms[case_short .. "_" .. g_short .. "_" .. number])) .. "\n")
end
end
end
return table.concat(ret)
end
local function make_post_cases(data)
local cases = {"nominative", "accusative", "genitive", "dative", "locative", "instrumental", "comitative", "vocative"}
local genders = {"lunar", "solar", "terrestrial", "aquatic"}
local ret = {}
data.pre = false
for _, case in ipairs(cases) do
for _, case in ipairs(cases) do
Line 154: Line 132:
local g_short = sub(gender, 1, 1)
local g_short = sub(gender, 1, 1)
for _, number in ipairs({"sg", "pl"}) do
for _, number in ipairs({"sg", "pl"}) do
table.insert(ret, "| " .. link(show_form(data.forms["post_" .. case_short .. "_" .. g_short .. "_" .. number])) .. "\n")
table.insert(ret, "| " .. link(show_form(data.forms[(pre and "" or "post") .. case_short .. "_" .. g_short .. "_" .. number])) .. "\n")
end
end
end
end
Line 184: Line 162:
! ]=] .. g_tooltip("s", "ol") .. [=[​
! ]=] .. g_tooltip("s", "ol") .. [=[​
! ]=] .. g_tooltip("p", "pa") .. [=[​
! ]=] .. g_tooltip("p", "pa") .. [=[​
|- ]=] .. make_pre_cases(data) .. [=[
|- ]=] .. make_pre_cases(data, true) .. [=[
|}<ul style="margin-left:0px;"></ul>
|}<ul style="margin-left:0px;"></ul>
]=]
]=]
Line 205: Line 183:
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. [=[&#x200B;
|- style="background-color:#fdfdfd;" ]=] .. make_post_cases(data) .. [=[
|- style="background-color:#fdfdfd;" ]=] .. make_post_cases(data, false) .. [=[
|}
|}
]=]
]=]