Module:R:es:DEM

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module implements the reference template {{R:es:DEM}}.


local export = {}
 
local chart = { ['ó']='o', ['í']='i' }

function export.create(frame)
	local args = frame:getParent().args
	if args['w'] and args[2] then
		error("please specify only either |w= or |2=")
	end
	local title = args['w'] or args[2] or mw.title.getCurrentTitle().text
	local termURLCode = args[1] or mw.ustring.gsub(title,'.',chart)
	local link = ""
	if termURLCode == '' then
		link = "''DEM'' onlinr"
	else
		link = "“[https://dem.colmex.mx/Ver/"..termURLCode..' '..title.."]” in ''Diccionario del Español de México'' online."
	end
	return link
end
 
return export