Saltar ao contido

Módulo:la-formlimp

do Galizionario, dicionario galego na Internet.

A documentación deste módulo pódese crear en "Módulo:la-formlimp/uso"

-- Module:strConversion
-- 2018-08-01 -- V5.1 -- +adverbium
-- {{#invoke:strConversion|laConvert|{{{1}}}}}
-- laConvert: Converting Latin string into text string without diacritics.
-- Recognized characters: Ā ā Ă ă Ē ē Ĕ ĕ Ë ë Ī ī Ĭ ĭ Ō ō Ŏ ŏ Ū ū Ŭ ŭ Û û Ȳ ȳ Y̆ y̆ 
-- {{#invoke:strConversion|inversio|{{{1}}}}}
-- laAncora: Replacing all tokens found in xTab.
-- inversio: Inverting all character positions of a string.

local export = {}

local cvTab =
	{
	["ărĭbus"]='arĭbus', ["ĕrĭbus"]='erĭbus', ["ĭrĭbus"]='erĭbus', ["ŏrĭbus"]='orĭbus', ["ŭrĭbus"]='ŭrĭbus',   
	}

function export.laConvert(frame)
	return laString(frame.args[1])
end

function laString(str)
	local newstr = ""
	newstr = mw.ustring.gsub(str, '.', cvTab)
	newstr = mw.ustring.gsub(newstr, 'Y̆', 'Y')
	newstr = mw.ustring.gsub(newstr, 'y̆', 'y')
	return newstr
end

function export.inversio(frame)
	local newstr = ""
	for i = mw.ustring.len( frame.args[1] ), 1, -1 do
        newstr = newstr .. mw.ustring.char(mw.ustring.codepoint(frame.args[1],i))
	end
	return newstr
end

return export

-- End of Module:strConversion