Module:R:it:Olivetti

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

This module implements the reference template {{R:it:Olivetti}}.


local export = {}

function export.create(frame) 
	 local params = {
		[1] = {list = true, default = mw.title.getCurrentTitle().text},
		["alt"] = {list = true, allow_holes = true},
	}
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local links = {}
	for i, term in ipairs(args[1]) do
		if term == "+" then
			term = mw.title.getCurrentTitle().text
		end
		local alt = args.alt[i] or term
		local url = "https://www.dizionario-italiano.it/dizionario-italiano.php?parola=" .. mw.uri.encode(term)
		table.insert(links, "[" .. url .. " " .. alt .. "]")
	end
	local joined_links = table.concat(links, ", ")
	return joined_links .. " in ''Dizionario Italiano Olivetti'', Olivetti Media Communication"
end

return export