10,735
edits
TheNightAvl (talk | contribs) mNo edit summary |
TheNightAvl (talk | contribs) mNo edit summary |
||
Line 47: | Line 47: | ||
end | end | ||
function export. | 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) | ||
local to_add = "<th" | |||
if rowspan and rowspan~=1 then | if rowspan and rowspan~=1 then to_add = to_add .. " rowspan=" .. rowspan end | ||
if colspan and colspan~=1 then | if colspan and colspan~=1 then to_add = to_add .. " colspan=" .. colspan end | ||
to_add = to_add .. ">" .. data .. "</th>" | |||
add(to_add) | |||
end | end | ||
local function td(data, rowspan, colspan) | local function td(data, rowspan, colspan) | ||
local to_add = "<td" | |||
if rowspan and rowspan~=1 then | if rowspan and rowspan~=1 then to_add = to_add .. " rowspan=" .. rowspan end | ||
if colspan and colspan~=1 then | if colspan and colspan~=1 then to_add = to_add .. " colspan=" .. colspan end | ||
to_add = to_add .. ">" .. data .. "</td>" | |||
add(to_add) | |||
end | end | ||
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\">") | ||
if table_type == "sgpl" then | |||
th("Declension of <i>" .. stems.nom .. "</i> (" .. type_name .. ")  ", 1, 4) | th("Declension of <i>" .. stems.nom .. "</i> (" .. type_name .. ")  ", 1, 4) | ||
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. | =p.show(mw.getCurrentFrame():newChild{title="whatever",args={"hv", "o~u^u", "þ"}}) | ||
]]-- | ]]-- |