Module:rad-stem/templates: Difference between revisions

Added irregular form marking (hopefully)
No edit summary
(Added irregular form marking (hopefully))
Line 8: Line 8:


local irregular_icon = "†"
local irregular_icon = "†"
irregular_icon = "<abbr title=\"irregular\">" .. irregular_icon .. "</abbr>"


local C = "bcdðfghħjĵkķlmnņpqrsștvwxzþ°"
local C = "bcdðfghħjĵkķlmnņpqrsștvwxzþ°"
Line 117: Line 118:
if type(word) == "string" then
if type(word) == "string" then
local irr_temp = ""
if mw.ustring.find(word, "%*") then
irr_temp = irregular_icon
word = mw.ustring.gsub(word, "%*", "")
end
if noipa then
if noipa then
local temp = rad_link(word)
local temp = rad_link(word)
if post then temp = temp .. post_space .. rad_link(post) end
if post then temp = temp .. post_space .. rad_link(post) end
if pre then temp = rad_link(pre) .. pre_space .. temp end
if pre then temp = rad_link(pre) .. pre_space .. temp end
return temp
return temp .. irr_temp
else
else
local temp = rad_link(word)
local temp = rad_link(word)
Line 133: Line 139:
ipa_temp = pre .. pre_space .. ipa_temp
ipa_temp = pre .. pre_space .. ipa_temp
end
end
return temp .. "<br>" .. rad_IPA(ipa_temp)
return temp .. irr_temp .. "<br>" .. rad_IPA(ipa_temp)
end
end
elseif type(word) == "table" then
elseif type(word) == "table" then
Line 139: Line 145:
local IPAs = {}
local IPAs = {}
for _, i in ipairs(word) do
for _, i in ipairs(word) do
local irr_temp = ""
if mw.ustring.find(i['word'], "%*") then
irr_temp = irregular_icon
i['word'] = mw.ustring.gsub(i['word'], "%*", "")
end
local new_link = rad_link(i['word'])
local new_link = rad_link(i['word'])
if post then new_link = new_link .. post_space .. rad_link(post) end
if post then new_link = new_link .. post_space .. rad_link(post) end
if pre then new_link = rad_link(post) .. pre_space .. new_link end
if pre then new_link = rad_link(post) .. pre_space .. new_link end
new_link = new_link .. irr_temp
if i['note'] then new_link = new_link .. " <small>(" .. i['note'] .. ")</small>" end
if i['note'] then new_link = new_link .. " <small>(" .. i['note'] .. ")</small>" end
table.insert(links, new_link)
table.insert(links, new_link)