This module is invoked by {{yo-link}}
.
local export = {}
local m_links = require("Module:links")
local lang = require("Module:languages").getByCode("yo")
function export.remove_tone_marks(text)
local replacements = {
= "a", = "a", = "a",
= "e", = "e", = "e",
= "i", = "i", = "i",
= "o", = "o", = "o",
= "u", = "u", = "u",
= "A", = "A", = "A",
= "E", = "E", = "E",
= "I", = "I", = "I",
= "O", = "O", = "O",
= "U", = "U", = "U",
= "n", = "n",
= "N", = "N"
}
text = string.gsub(text, "*", function(c)
return replacements or c
end)
text = mw.ustring.gsub(text, "", "")
return text
end
function export.yolink(frame)
local args = frame:getParent().args
local sent = args or ''
local result = {}
for word in sent:gmatch("%S+") do
local term = export.remove_tone_marks(word)
table.insert(result, m_links.full_link({lang = lang, term = word, alt = word}))
end
return "''" .. table.concat(result, " ") .. "''"
end
return export