Module:qhv-verb: Difference between revisions

4,385 bytes removed ,  16 April 2021
no edit summary
No edit summary
No edit summary
Line 92: Line 92:


function make_table(data)
function make_table(data)
local function g_tooltip(n1, n2)
return require('Module:getn').format_list({n1, n2})
end
local function show_form(form)
local function show_form(form)
if not form then
if not form then
Line 125: Line 121:
return data.decl_type
return data.decl_type
elseif param == "pagename" and NAMESPACE == "Template" then
elseif param == "pagename" and NAMESPACE == "Template" then
return "rōva"
return "sylugon"
elseif param == "pagename" then
elseif param == "pagename" then
return PAGENAME
return PAGENAME
Line 133: Line 129:
end
end


local function make_cases(data, pre)
local function make_cases(data, mode)
local cases = {"nominative", "accusative", "genitive", "dative", "locative", "instrumental", "comitative", "vocative"}
local voices, moods, tenses = {}, {}, {}
local genders = data.decl_type == "I" and {"lunar", "solar", "terrestrial", "aquatic"} or {"lunar", "terrestrial"}
local ret = {}
local ret = {}
for _, case in ipairs(cases) do
if match(mode) == "^finite" then
local case_short = sub(case, 1, 3)
voices = {{"act", "active"}, {"pas", "passive"}}
table.insert(ret, "|- style=\"background-color: #fdfdfd;\" \n! ! style=\"background-color: #FFB976; width:" .. (data.decl_type == "I" and "11.5%" or "16.68%") .. ";\"|" .. case .. "\n")
moods = {{"ind", "indicative"}, {"sub", "subjunctive"}, {"imp", "imperative"}, {"inf", "infinitive"}, {"part", "participle"}}
for _, gender in ipairs(genders) do
tenses = {{"prs", "present"}, {"aor", "aorist"}, {"fut", "future"}, {"imperf", "imperfect"},
local g_short = sub(gender, 1, 1)
  {"prf", "perfect"}, {"plu", "pluperfect"}, {"hab", "past habitual"}}
for _, number in ipairs({"sg", "pl"}) do
table.insert(ret, "|-\n! colspan='7' style='background: #ADE981; width: 7em' | " .. (match(mode, "%s(.*)$")) .. "\n")
table.insert(ret, "| style=\"width:" .. (data.decl_type == "I" and "10.10%" or "20.83%") .. ";\" | " .. link(show_form(data.forms[(pre and "" or "post_") .. case_short .. "_" .. g_short .. "_" .. number])) .. "\n")
for _, mood in ipairs(moods) do
table.insert(ret, "! style='background: #ADE981; width: 7em' | " .. mood[2] .. "\n")
for _, tense in ipairs(tenses) do
table.insert(ret, "! style='background: #ADE981; width: 7em' | " .. tense[2] .. "\n")
for _, number in ipairs({"sg", "pl"}) do
for i=1, 3 do
table.insert(ret, "| " .. link(show_form(data.forms[(match(mode, "%s(.*)$") == "active" and "act" or "pas") .. "_" .. mood[1] .. "_" .. tense[1] .. "_" .. tostring(i) .. number])) .. "\n")
end
end
end
end
end
end
else
end
end
return table.concat(ret)
return table.concat(ret)
Line 155: Line 160:
<div style="min-height: 1.6em; font-weight:bold; font-size: 100%; text-align: left; background-color:#efefef; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);  background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);"><span class="nowrap">Declension of ''<span lang="qhv">{{{pagename}}}</span>'' ([[:Category:High Valyrian class-{{{decl_type}}} adjectives|class {{{decl_type}}}]])</span></div>
<div style="min-height: 1.6em; font-weight:bold; font-size: 100%; text-align: left; background-color:#efefef; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);  background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);"><span class="nowrap">Declension of ''<span lang="qhv">{{{pagename}}}</span>'' ([[:Category:High Valyrian class-{{{decl_type}}} adjectives|class {{{decl_type}}}]])</span></div>
<div class="mw-collapsible-content" style="font-size: 100%;">
<div class="mw-collapsible-content" style="font-size: 100%;">
]=]
local prepositive = [=[
{| border="1px solid white" style="border-collapse: collapse; background:#ffffff; width:100%; text-align:center;" cellspacing="1" cellpadding="2"
|- style="background-color: #FFB976; text-align:center;"
! rowspan="2" style="background-color: #E57942;" | Prepositive
! colspan="2" | lunar]=] .. (data.decl_type ~= "I" and " and solar" or "") .. (data.decl_type == "I" and "\n! colspan=\"2\" | solar" or "") .. [=[&#x200B;
! colspan="2" | terrestrial]=] .. (data.decl_type ~= "I" and " and aquatic" or "") .. (data.decl_type == "I" and "\n! colspan=\"2\" | aquatic" or "") .. [=[&#x200B;
|- style="background-color: #FFD79B; font-size: 95%"
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. [=[&#x200B;
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. (data.decl_type ~= "I" and "" or [=[&#x200B;
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. [=[&#x200B;
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa")) .. [=[&#x200B;
|- ]=] .. make_cases(data, true) .. [=[
|}<ul style="margin-left:0px;"></ul>
]=]
local postpositive = [=[
{| border="1px solid white" style="border-collapse: collapse; background:#ffffff; width:100%; text-align:center;" cellspacing="1" cellpadding="2"
|- style="background-color: #FFB976; text-align:center;"
! rowspan="2" style="background-color: #E57942;" | Postpositive
! colspan="2" ]=] .. (data.decl_type ~= "I" and "style=\"min-width: 20.83%;\" | lunar and solar" or "| lunar") .. (data.decl_type == "I" and "\n! colspan=\"2\" | solar" or "") .. [=[&#x200B;
! colspan="2" ]=] .. (data.decl_type ~= "I" and "style=\"min-width: 20.83%;\" | terrestrial and aquatic" or "| terrestrial") .. (data.decl_type == "I" and "\n! colspan=\"2\" | aquatic" or "") .. [=[&#x200B;
|- style="background-color: #FFD79B; font-size: 95%"
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. [=[&#x200B;
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. (data.decl_type ~= "I" and "" or [=[&#x200B;
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa") .. [=[&#x200B;
! ]=] .. g_tooltip("s", "ol") .. [=[&#x200B;
! ]=] .. g_tooltip("p", "pa")) .. [=[&#x200B;
|- ]=] .. make_cases(data, false) .. [=[
|}
]=]
]=]
local final = [=[
local final = [=[
<div class="mw-collapsible mw-collapsed" style="border-collapse: collapse; margin: 0px 0px -1px 0px; padding: 2px; text-align: center; border: 1px solid #aaaaaa; font-size: 95%; overflow: auto; width: auto;">
<div style="min-height: 1.6em; font-weight:bold; font-size: 100%; text-align: left; background-color:#efefef; padding-left: 10px; background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#DFDFDF), color-stop(0.6, #E3E3E3)); background-image: -moz-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);  background-image: -o-linear-gradient(top, #EFEFEF, #E3E3E3 60%, #DFDFDF);"><span class="nowrap">Conjugation of ''<span lang="qhv">{{{pagename}}}</span>'' — active voice</span></div>
<div class="mw-collapsible-content" style="font-size: 100%;">
{| style="background:#F9F9F9; text-align:center; width:100%; border-collapse: collapse;" border="1px solid #000"
{| style="background:#F9F9F9; text-align:center; width:100%; border-collapse: collapse;" border="1px solid #000"
|- style="background: #7AB350"
|- style="background: #7AB350"
Line 219: Line 183:
! pōnta
! pōnta
|-
|-
! rowspan="7" style="background: #7AB350; width: 7em" | indicative
]=] .. make_cases(data, "finite active") .. [=[
! style="background: #ADE981; width: 7em" | present
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | aorist
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | future
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | imperfect
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | perfect
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | pluperfect
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | past habitual
|
|
|
|
|
|
|-
! style="background:#808080; height:.2em" colspan="9" |
|-
! rowspan="7" style="background: #7AB350; width: 7em" | subjunctive
! style="background: #ADE981; width: 7em" | present
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | aorist
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | future
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | imperfect
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | perfect
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | pluperfect
|
|
|
|
|
|
|-
! style="background: #ADE981; width: 7em" | past habitual
|
|
|
|
|
|
|-
|-
! style="background:#808080; height:.2em" colspan="9" |
! style="background:#808080; height:.2em" colspan="9" |