Module:rad-stem/templates: Difference between revisions

m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 14: Line 14:
function add(code)
function add(code)
table.insert(format_table, code)
table.insert(format_table, code)
end
function tr()
table.insert(format_table, "<tr>")
end
function tr_()
table.insert(format_table, "</tr>")
end
end
Line 235: Line 243:
end
end
add("<tr>")
tr()
th("", 1, 2)
th("", 1, 2)
th("singular")
th("singular")
th("plural")
th("plural")
add("</tr>")
tr_()
add("<tr>")
tr()
th("nominative", 1, 2)
th("nominative", 1, 2)
if nom == nompl then
if nom == nompl then
Line 251: Line 259:
td(nompl, 2)
td(nompl, 2)
end
end
add("</tr>")
tr_()
add("<tr>")
tr()
th("vocative", 1, 2)
th("vocative", 1, 2)
if nom ~= nompl and nom ~= voc then td(voc) end
if nom ~= nompl and nom ~= voc then td(voc) end
add("</tr>")
tr_()
add("<tr>")
tr()
th("genitive", 2, 1)
th("genitive", 2, 1)
th("long")
th("long")
td(gen, 2, 1)
td(gen, 2, 1)
td(genpl)
td(genpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("short")
th("short")
td(genpl_short)
td(genpl_short)
add("</tr>")
tr_()
add("<tr>")
tr()
th("dative", 1, 2)
th("dative", 1, 2)
td(dat)
td(dat)
td(datpl)
td(datpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("accusative", 1, 2)
th("accusative", 1, 2)
td(acc)
td(acc)
td(accpl)
td(accpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("instrumental", 1, 2)
th("instrumental", 1, 2)
td(ins)
td(ins)
td(inspl)
td(inspl)
add("</tr>")
tr_()
elseif table_type == "sg" then
elseif table_type == "sg" then
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 2)
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 2)
add("<tr>")
tr()
th("")
th("")
th("singular")
th("singular")
add("</tr>")
tr_()
add("<tr>")
tr()
th("nominative")
th("nominative")
if nom == voc then td(nom, 2) else td(nom) end
if nom == voc then td(nom, 2) else td(nom) end
add("</tr>")
tr_()
add("<tr>")
tr()
th("vocative")
th("vocative")
if nom ~= voc then td(voc) end
if nom ~= voc then td(voc) end
add("</tr>")
tr_()
add("<tr>")
tr()
th("genitive")
th("genitive")
td(gen)
td(gen)
add("</tr>")
tr_()
add("<tr>")
tr()
th("dative")
th("dative")
td(dat)
td(dat)
add("</tr>")
tr_()
add("<tr>")
tr()
th("accusative")
th("accusative")
td(acc)
td(acc)
add("</tr>")
tr_()
add("<tr>")
tr()
th("instrumental")
th("instrumental")
td(ins)
td(ins)
add("</tr>")
tr_()
elseif table_type == "pl" then
elseif table_type == "pl" then
th("Declension of <i>" .. nompl_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 3)
th("Declension of <i>" .. nompl_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 3)
add("<tr>")
tr()
th("", 1, 2)
th("", 1, 2)
th("plural")
th("plural")
add("</tr>")
tr_()
add("<tr>")
tr()
th("nominative", 1, 2)
th("nominative", 1, 2)
td(nompl, 2)
td(nompl, 2)
add("</tr>")
tr_()
add("<tr>")
tr()
th("vocative", 1, 2)
th("vocative", 1, 2)
add("</tr>")
tr_()
add("<tr>")
tr()
th("genitive", 2, 1)
th("genitive", 2, 1)
th("long")
th("long")
td(genpl)
td(genpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("short")
th("short")
td(genpl_short)
td(genpl_short)
add("</tr>")
tr_()
add("<tr>")
tr()
th("dative", 1, 2)
th("dative", 1, 2)
td(datpl)
td(datpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("accusative", 1, 2)
th("accusative", 1, 2)
td(accpl)
td(accpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("instrumental", 1, 2)
th("instrumental", 1, 2)
td(inspl)
td(inspl)
add("</tr>")
tr_()
elseif table_type == "du" then
elseif table_type == "du" then
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 5)
th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 5)
add("<tr>")
tr()
th("", 2, 2)
th("", 2, 2)
th("singular", 2, 1)
th("singular", 2, 1)
th("plural", 1, 2)
th("plural", 1, 2)
add("</tr>")
tr_()
add("<tr>")
tr()
th("binary")
th("binary")
th("true")
th("true")
add("</tr>")
tr_()
add("<tr>")
tr()
th("nominative", 1, 2)
th("nominative", 1, 2)
if nom == voc then td(nom, 2) else td(nom) end
if nom == voc then td(nom, 2) else td(nom) end
td(nomdu, 2)
td(nomdu, 2)
td(nompl, 2)
td(nompl, 2)
add("</tr>")
tr_()
add("<tr>")
tr()
th("vocative", 1, 2)
th("vocative", 1, 2)
if nom ~= voc then td(voc) end
if nom ~= voc then td(voc) end
add("</tr>")
tr_()
add("<tr>")
tr()
th("genitive", 2, 1)
th("genitive", 2, 1)
th("long")
th("long")
Line 372: Line 380:
td(gendu)
td(gendu)
td(genpl)
td(genpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("short")
th("short")
td(gendu_short)
td(gendu_short)
td(genpl_short)
td(genpl_short)
add("</tr>")
tr_()
add("<tr>")
tr()
th("dative", 1, 2)
th("dative", 1, 2)
td(dat)
td(dat)
td(datdu)
td(datdu)
td(datpl)
td(datpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("accusative", 1, 2)
th("accusative", 1, 2)
td(acc)
td(acc)
td(accdu)
td(accdu)
td(accpl)
td(accpl)
add("</tr>")
tr_()
add("<tr>")
tr()
th("instrumental", 1, 2)
th("instrumental", 1, 2)
td(ins)
td(ins)
td(insdu)
td(insdu)
td(inspl)
td(inspl)
add("</tr>")
tr_()
elseif table_type == "dupl" then
elseif table_type == "dupl" then
th("Declension of <i>" .. nomdu_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 3)
th("Declension of <i>" .. nomdu_cite .. "</i> (" .. type_name .. ") &nbsp;", 1, 3)
add("<tr>")
tr()
th("", 1, 2)
th("", 1, 2)
th("binary plural")
th("binary plural")
add("</tr>")
tr_()
add("<tr>")
tr()
th("nominative", 1, 2)
th("nominative", 1, 2)
td(nomdu, 2)
td(nomdu, 2)
add("</tr>")
tr_()
add("<tr>")
tr()
th("vocative", 1, 2)
th("vocative", 1, 2)
add("</tr>")
tr_()
add("<tr>")
tr()
th("genitive", 2, 1)
th("genitive", 2, 1)
th("long")
th("long")
td(gendu)
td(gendu)
add("</tr>")
tr_()
add("<tr>")
tr()
th("short")
th("short")
td(gendu_short)
td(gendu_short)
add("</tr>")
tr_()
add("<tr>")
tr()
th("dative", 1, 2)
th("dative", 1, 2)
td(datdu)
td(datdu)
add("</tr>")
tr_()
add("<tr>")
tr()
th("accusative", 1, 2)
th("accusative", 1, 2)
td(accdu)
td(accdu)
add("</tr>")
tr_()
add("<tr>")
tr()
th("instrumental", 1, 2)
th("instrumental", 1, 2)
td(insdu)
td(insdu)
add("</tr>")
tr_()
end
end
add("</table>")
add("</table>")
Line 450: Line 458:
local args = getArgs(frame)
local args = getArgs(frame)
local pp = m_stem.getVerbStem(args)
local pp = m_stem.getVerbStem(args)
mw.logObject(pp)
format_table = {}
mw.logObject(pp)
if (args["t"] == "tr" or args["t"] == "pass") and args[6] == nil and args[7] == nil then error("Passive conjugation tables require arguments 6 (infinitive) and 7 (present participle stem).") end
add("<small>")
add("<table class=\"mw-collapsible mw-collapsed wikitable inflection table\" width=100% style=\"text-align: center\">")
tr()
th("Conjugation of ''" .. pp.inf .. "'' (active voice) &nbsp;", 1, 14)
tr_()
add("</table>")
add("</small")
return table.concat(format_table, string.char(10))
end
end


Line 461: Line 479:
Debug console test string:
Debug console test string:
=p.show(mw.getCurrentFrame():newChild{title="whatever",args={"hv", "o~u^u", "þ"}})
=p.show(mw.getCurrentFrame():newChild{title="whatever",args={"hv", "o~u^u", "þ"}})
=p.conjugate(mw.getCurrentFrame():newChild{title="whatever",args={"deat","de",["1s"]="dei",["3s"]="deaș",["pl"]="di","diș","deti","dev"}})
]]--
]]--