Jump to content

Module:R:es:Lexico

From Wiktionary, the free dictionary

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


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 = "''Lexico'' online"
	else
		link = "“[https://www.lexico.com/es/definicion/"..termURLCode..' '..title.."]” in ''[[w:Lexico|Lexico]]'', [[w:Oxford University Press|Oxford University Press]]."
	end
	return link
end
 
return export