Module:R:vec:Galepin

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

This module implements the reference template {{R:vec:Galepin}}.


local export = {}

function export.main(frame)

	local args = require("Module:parameters").process(frame:getParent().args, {
		[1] = { list = true },
	})[1]

	local ret = "“"

	for i, v in ipairs(args) do
		if i ~= 1 then
			ret = ret .. "”, “"
		end
		local id, name
		if v:find("^%d+$") then
			id, name = v, mw.title.getCurrentTitle().text
		elseif v:find("^%d+:.+$") then
			id, name = v:match("^(%d+):(.+)$")
		else
			error("The parameter |" .. i .. "= has unsupported input.")
		end
		ret = ret .. "[https://www.elgalepin.com/result.asp?ID=" .. id .. " " .. name .. "]"
	end

	return ret .. "”, in <cite>el Galepin – www.elgalepin.com</cite>"

end

return export