Module:Wt/lij/Cirillico

From Wikimedia Incubator

it:wikt:Module:Cirillico


p = {}

function p.noaccenti(x) -- funzione che rimuove l'accento acuto cirillico dal suo argomento nei wikilink
	local dp={
	['́'] = ''
	};
	return (mw.ustring.gsub(x, '.', dp))
	end
	
	function p.radice(frame) --restituisce semplicemente il suo argomento senza accenti
	pframe = frame:getParent()
	config = frame.args
	args = pframe.args
-- Argomenti passati dal template
	x = config["x"] or " "
	radice = p.noaccenti(x)
	return radice
	end
	
function p.link(frame) --crea i wikilink nella forma [[senza_accento|con_accento]]
	pframe = frame:getParent()
	config = frame.args
	args = pframe.args
-- Argomenti passati dal template
	x = config["x"] or " "
	if x < "a" then
		link = "n.e."
	else
		if p.noaccenti(x) == mw.title.getCurrentTitle().text then
			link = x
		else
			link = "[[".. p.noaccenti(x) .. "|".. x.. "]]"
		end
	end
	return link
	end

return p