10,735
edits
TheNightAvl (talk | contribs) mNo edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 51: | Line 51: | ||
} | } | ||
return "<span style=\"color:dimgrey\">" .. IPA .. "</span>" | return "<span style=\"color:dimgrey\">" .. IPA .. "</span>" | ||
end | |||
function rad_link_IPA(word) | |||
if type(word) == "string" then | |||
return rad_link(word) .. "<br>" .. rad_IPA(word) | |||
elseif type(word) == "table" then | |||
local links = {} | |||
local IPAs = {} | |||
for _, i in ipairs(word) do | |||
local new_link = rad_link(i['word']) | |||
if i['note'] then new_link = new_link .. " (<i>" .. i['note'] .. "</i>)" end | |||
table.insert(links, new_link) | |||
table.insert(IPAs, rad_IPA(i['word'])) | |||
end | |||
return table.concat(links, ", ") .. "<br>" .. table.concat(IPAs, " ") | |||
else error("Incompatible input type for rad_link_IPA") | |||
end | |||
end | end | ||
Line 65: | Line 82: | ||
genpl = args['genpl'] or stem_gen.genpl, | genpl = args['genpl'] or stem_gen.genpl, | ||
genpl_short = args['genpl_short'] or stem_gen.genpl_short, | genpl_short = args['genpl_short'] or stem_gen.genpl_short, | ||
['type'] = stem_gen['type'] | ['type'] = stem_gen['type'], | ||
} | } | ||
local adj = args['adj'] | local adj = args['adj'] | ||
Line 71: | Line 88: | ||
local adj_broken_e = "" | local adj_broken_e = "" | ||
if adj then | if adj then | ||
adj = " " .. adj | |||
adj_broken = args['adjbreak'] or break_adj(adj) | adj_broken = args['adjbreak'] or break_adj(adj) | ||
adj_broken_e = mw.ustring.gsub(adj_broken, "(uș)$", "ûș") | adj_broken_e = mw.ustring.gsub(adj_broken, "(uș)$", "ûș") | ||
adj_broken_e = mw.ustring.gsub(adj_broken, "(aûș)$", "auș") | |||
adj_broken_e = mw.ustring.gsub(adj_broken, "(aùș)$", "aûș") | |||
adj_broken_e = adj_broken_e .. "e" | |||
adj = mw.ustring.gsub(adj, "(°)", "") | |||
else | |||
adj_broken = nil | |||
adj_broken_e = nil | |||
end | end | ||
local post = args['post'] | |||
local format_table = {} | local format_table = {} | ||
Line 108: | Line 134: | ||
add(to_add) | add(to_add) | ||
end | end | ||
-- generate forms -- | |||
local nom = stems.nom | |||
if adj_broken_e then nom = nom .. adj_broken_e end | |||
if post then nom = nom .. post end | |||
local nom_cite = nom | |||
nom = rad_link_IPA(nom) | |||
local gen = stems.gen | |||
if adj_broken then gen = gen .. adj_broken .. "k" end | |||
if post then gen = gen .. post end | |||
if args['altgen'] then | |||
local list = { | |||
[1] = {['word'] = gen}, | |||
[2] = {['word'] = args['altgen'], ['note'] = args['altgen_note']} | |||
} | |||
local counter = 2 | |||
while args['altgen' .. counter] do | |||
local temp = args['altgen' .. counter] | |||
if adj_broken then temp = temp .. adj_broken .. "k" end | |||
if post then temp = temp .. post end | |||
list[counter + 1] = {['word'] = temp, ['note'] = args['altgen' .. counter .. "_note"]} | |||
counter = counter + 1 | |||
end | |||
gen = rad_link_IPA(list) | |||
else | |||
gen = rad_link_IPA(gen) | |||
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 | if table_type == "sgpl" then | ||
th("Declension of <i>" .. | th("Declension of <i>" .. nom_cite .. "</i> (" .. type_name .. ")  ", 1, 4) | ||
add("<tr>") | add("<tr>") | ||
th("nominative", 1, 2) | th("nominative", 1, 2) | ||
if | if nom == nompl then | ||
td( | td(nom, 1, 2) | ||
else | else | ||
td( | td(nom) | ||
end | end | ||
add("</tr>") | |||
add("<tr>") | |||
th("genitive", 2, 1) | |||
th("proper") | |||
td(gen) | |||
add("</tr>") | add("</tr>") | ||
elseif table_type == "sg" then | elseif table_type == "sg" then |