Module:yo-link

Hello, you have come here looking for the meaning of the word Module:yo-link. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:yo-link, but we will also tell you about its etymology, its characteristics and you will know how to say Module:yo-link in singular and plural. Everything you need to know about the word Module:yo-link you have here. The definition of the word Module:yo-link will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:yo-link, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Description

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