Module:rad-stem/templates: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 907: Line 907:
end
end
if checked then
 
local form_3s = get_forms(pp['3s'])
local form_3s = get_forms(pp['3s'])
local form_2s = get_forms(pp.depers or pp['2s'], "", "nv$", "nu")
local form_2s = get_forms(pp.depers or pp['2s'], "", "nv$", "nu")
Line 2,333: Line 2,333:
if irregular then add("[[Category:Radestrian irregular verbs]]") end
if irregular then add("[[Category:Radestrian irregular verbs]]") end
return table.concat(format_table, string.char(10))
local function check_stems()
local endings = {
else
local endings = {
    ['1s'] = "",
    ['1s'] = "",
    ['2s'] = "úș",
    ['2s'] = "úș",
Line 2,356: Line 2,353:
    ['rpst'] = "uveș",
    ['rpst'] = "uveș",
    ['vnoun'] = "",
    ['vnoun'] = "",
}
}
local review = {}
local review = {}
for i, j in pairs(pp) do
for i, j in pairs(pp) do
local nonforms = {["vstem"] = true, ["t"] = true, ["pre"] = true}
local nonforms = {["vstem"] = true, ["t"] = true, ["pre"] = true}
if not ((table_type == "intr" or table_type == "impers") and i == "rpst") and not nonforms[i] and not ((i == "apst" or i == "rpst" or i == "pl" or i == "vnoun" or i == "1s") and table_type == "impers") then
if not ((table_type == "intr" or table_type == "impers") and i == "rpst") and not nonforms[i] and not ((i == "apst" or i == "rpst" or i == "pl" or i == "vnoun" or i == "1s") and table_type == "impers") then
if type(j) == "string" then
if type(j) == "string" then
table.insert(review, "* <code>" .. string.upper(i) .. "</code>: '''" .. j .. "'''" .. endings[i])
table.insert(review, "* <code>" .. string.upper(i) .. "</code>: '''" .. j .. "'''" .. endings[i])
elseif type(j) == "table" then
elseif type(j) == "table" then
for k, l in ipairs(j) do
for k, l in ipairs(j) do
local temp = "* <code>" .. string.upper(i) .. "[" .. k .. "]</code>: '''" .. l.word .. "'''" .. endings[i]
local temp = "* <code>" .. string.upper(i) .. "[" .. k .. "]</code>: '''" .. l.word .. "'''" .. endings[i]
if l.note then temp = temp .. " (" .. l.note .. ")" end
if l.note then temp = temp .. " (" .. l.note .. ")" end
table.insert(review, temp)
table.insert(review, temp)
end
end
end
end
end
end
end
end
if pp.pl == nil and table_type ~= "impers" then
if pp.pl == nil and table_type ~= "impers" then
if type(pp['2s']) == "table" then
if type(pp['2s']) == "table" then
for i,j in ipairs(pp['2s']) do
for i,j in ipairs(pp['2s']) do
local temp = "* <code>PL[" .. i .. "]</code>: '''" .. j['word'] .. "'''" ..  endings['pl'] .. " (<code>2S[" .. i .. "]</code>" .. endings['pl'] .. ")"
local temp = "* <code>PL[" .. i .. "]</code>: '''" .. j['word'] .. "'''" ..  endings['pl'] .. " (<code>2S[" .. i .. "]</code>" .. endings['pl'] .. ")"
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
table.insert(review, temp)
table.insert(review, temp)
end
elseif type(pp['2s']) == "string" then
table.insert(review, "* <code>PL</code>: '''" .. pp['2s'] .. "'''" .. endings['pl'] .. " (<code>2S</code>" .. endings['pl'] .. ")")
end
end
elseif type(pp['2s']) == "string" then
table.insert(review, "* <code>PL</code>: '''" .. pp['2s'] .. "'''" .. endings['pl'] .. " (<code>2S</code>" .. endings['pl'] .. ")")
end
end
end
if pp.depers == nil then
if pp.depers == nil then
if type(pp['2s']) == "table" then
if type(pp['2s']) == "table" then
for i,j in ipairs(pp['2s']) do
for i,j in ipairs(pp['2s']) do
local temp = "* <code>DEPERS[" .. i .. "]</code>: '''" .. mw.ustring.gsub(j['word'], "nv$", "nu") .. "''' (<code>2S[" .. i .. "]</code>)"
local temp = "* <code>DEPERS[" .. i .. "]</code>: '''" .. mw.ustring.gsub(j['word'], "nv$", "nu") .. "''' (<code>2S[" .. i .. "]</code>)"
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
table.insert(review, temp)
table.insert(review, temp)
end
elseif type(pp['2s']) == "string" then
table.insert(review, "* <code>DEPERS</code>: '''" .. mw.ustring.gsub(pp['2s'], "nv$", "nu") .. "''' (<code>2S</code>)")
end
end
elseif type(pp['2s']) == "string" then
table.insert(review, "* <code>DEPERS</code>: '''" .. mw.ustring.gsub(pp['2s'], "nv$", "nu") .. "''' (<code>2S</code>)")
end
end
end
if pp.imp == nil and table_type ~= "impers" then
if pp.imp == nil and table_type ~= "impers" then
if type(pp.a) == "table" then
if type(pp.a) == "table" then
if pp.vstem then
if pp.vstem then
for i,j in ipairs(pp.a) do
for i,j in ipairs(pp.a) do
local temp = "* <code>IMP[" .. i .. "]</code>: '''" .. mw.ustring.gsub(j['word'], "va$", "ja") .. "'''"
local temp = "* <code>IMP[" .. i .. "]</code>: '''" .. mw.ustring.gsub(j['word'], "va$", "ja") .. "'''"
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
table.insert(review, temp)
table.insert(review, temp)
end
else
for i,j in ipairs(pp.a) do
local temp = "* <code>IMP[" .. i .. "]</code> = '''" .. j['word'] .. "''' (<code>A[" .. i .. "]</code>)"
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
table.insert(review, temp)
end
end
end
else
elseif type(pp.a) == "string" then
for i,j in ipairs(pp.a) do
if pp.vstem then
local temp = "* <code>IMP[" .. i .. "]</code> = '''" .. j['word'] .. "''' (<code>A[" .. i .. "]</code>)"
table.insert(review, "* <code>IMP</code>: '''" .. mw.ustring.gsub(pp.a, "va$", "ja") .. "'''")
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
else
table.insert(review, temp)
table.insert(review, "* <code>IMP</code>: '''" .. pp.a .. "''' (<code>A</code>)")
end
end
end
elseif type(pp.a) == "string" then
if pp.vstem then
table.insert(review, "* <code>IMP</code>: '''" .. mw.ustring.gsub(pp.a, "va$", "ja") .. "'''")
else
table.insert(review, "* <code>IMP</code>: '''" .. pp.a .. "''' (<code>A</code>)")
end
end
end
end
end
if pp.epst == nil then
if pp.epst == nil then
if type(pp.pst) == "table" then
if type(pp.pst) == "table" then
for i,j in ipairs(pp.pst) do
for i,j in ipairs(pp.pst) do
local temp = "* <code>EPST[" .. i .. "]</code>: '''" .. j['word'] .. "e'''" .. endings['epst']
local temp = "* <code>EPST[" .. i .. "]</code>: '''" .. j['word'] .. "e'''" .. endings['epst']
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
if j['note'] then temp = temp .. " (" .. j['note'] .. ")" end
table.insert(review, temp)
table.insert(review, temp)
end
elseif type(pp.pst) == "string" then
table.insert(review, "* <code>EPST</code>: '''" .. pp.pst .. "e'''" .. endings['epst'])
end
end
elseif type(pp.pst) == "string" then
table.insert(review, "* <code>EPST</code>: '''" .. pp.pst .. "e'''" .. endings['epst'])
end
end
table.sort(review, function(a,b) return a < b end)
mw.addWarning("<div class=\"noprint maintenance-box maintenance-box-red\" style=\"background:#FFE7DD; width:90%; margin: 0.75em auto; border:1px dashed #884444; padding: 0.25em;\"><table><tr><td rowspan=\"2\">[[File:Nuvola_apps_important_yellow.svg|48px]]</td><th style=\"text-align: left;\">Please review the following stems</th></tr><tr><td>" .. string.char(10) .. table.concat(review, string.char(10)) .. string.char(10) .. "If all is okay, add <code>|check=1</code> to generate the tables.</td></tr></table></div>")
end
end
table.sort(review, function(a,b) return a < b end)
return "<div class=\"noprint maintenance-box maintenance-box-red\" style=\"background:#FFE7DD; width:90%; margin: 0.75em auto; border:1px dashed #884444; padding: 0.25em;\"><table><tr><td rowspan=\"2\">[[File:Nuvola_apps_important_yellow.svg|48px]]</td><th style=\"text-align: left;\">Please review the following stems</th></tr><tr><td>" .. string.char(10) .. table.concat(review, string.char(10)) .. string.char(10) .. "If all is okay, add <code>|check=1</code> to generate the tables.</td></tr></table></div>[[Category:Unchecked Radestrian conjugation tables]]"
check_stems()
end
return table.concat(format_table, string.char(10))
end
end


Navigation menu