Module:rad-stem/templates: Difference between revisions

Jump to navigation Jump to search
m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 47: Line 47:
end
end


function export.sg_pl(frame)
function export.show(frame)
local args = getArgs(frame)
local args = getArgs(frame)
local stems = get_stems(args)
local stems = get_stems(args)
Line 59: Line 59:
local format_table = {}
local format_table = {}
local decl_type = {
["C"] = "heavy",
["CH"] = "heavy spirant",
["VH"] = "light spirant",
["V"] = "light",
["G"] = "semi-light"
}
local type_name = decl_type[stems['type']]
local table_type = args['type'] or "sgpl"
local function add(code)
local function add(code)
Line 65: Line 77:
local function th(data, rowspan, colspan)
local function th(data, rowspan, colspan)
add("<th")
local to_add = "<th"
if rowspan and rowspan~=1 then add(" rowspan=" .. rowspan) end
if rowspan and rowspan~=1 then to_add = to_add .. " rowspan=" .. rowspan end
if colspan and colspan~=1 then add(" colspan=" .. colspan) end
if colspan and colspan~=1 then to_add = to_add .. " colspan=" .. colspan end
add(">" .. data .. "</th>")
to_add = to_add .. ">" .. data .. "</th>"
add(to_add)
end
end
local function td(data, rowspan, colspan)
local function td(data, rowspan, colspan)
add("<td")
local to_add = "<td"
if rowspan and rowspan~=1 then add(" rowspan=" .. rowspan) end
if rowspan and rowspan~=1 then to_add = to_add .. " rowspan=" .. rowspan end
if colspan and colspan~=1 then add(" colspan=" .. colspan) end
if colspan and colspan~=1 then to_add = to_add .. " colspan=" .. colspan end
add(">" .. data .. "</td>")
to_add = to_add .. ">" .. data .. "</td>"
add(to_add)
end
end
local decl_type = {
["C"] = "heavy",
["CH"] = "heavy spirant",
["VH"] = "light spirant",
["V"] = "light",
["G"] = "semi-light"
}
local type_name = decl_type[stems['type']]
add("<table class=\"mw-collapsible mw-collapsed wikitable inflection table\" style=\"text-align: center\">")
add("<table class=\"mw-collapsible mw-collapsed wikitable inflection table\" style=\"text-align: center\">")
add("<tr>")
if table_type == "sgpl" then
th("Declension of <i>" .. stems.nom .. "</i> (" .. type_name .. ") &nbsp", 1, 4)
th("Declension of <i>" .. stems.nom .. "</i> (" .. type_name .. ") &nbsp", 1, 4)
add("</tr>")
end
add("</table>")
add("</table>")
add("<includeonly>[[Category:Radestrian " .. type_name .. " stems]]</includeonly>")
add("<includeonly>[[Category:Radestrian " .. type_name .. " stems]]</includeonly>")
return table.concat(format_table)
return table.concat(format_table, string.char(10))
end
end


Line 103: Line 107:
--[[
--[[
Debug console test string:
Debug console test string:
=p.sg_pl(mw.getCurrentFrame():newChild{title="whatever",args={"hv", "o~u^u", "þ"}})
=p.show(mw.getCurrentFrame():newChild{title="whatever",args={"hv", "o~u^u", "þ"}})
]]--
]]--

Navigation menu