Module:Doorverwijspagina

Documentation for this module may be created at Module:Doorverwijspagina/doc

-- Module for disambiguation page stuff
local p = {}

function p.getlabel()
	local label = mw.title.getCurrentTitle().prefixedText
	label = string.gsub(label, "^(.*) %(doorverwijspagina%)$", "%1")
	return label
end

-- [[sjabloon:dpintro]]
function p.dpintro(frame)
	-- convert parent frame's args from a metatable to a regular table
	local args = {}
	for k, v in pairs(frame:getParent().args) do
		-- ignore empty strings
		if v ~= "" then
			args[k] = v
		end
	end
	-- first argument is implicit
	if args[1] == nil then
		args[1] = p.getlabel()
	end
	local r
	for index, arg in ipairs(args) do
		if index == 1 then
			r = ""
		elseif index == #args then
			r = r .. " of "
		else
			r = r .. ", "
		end
		r = r .. "'''" .. arg .. "'''"
	end
	r = r .. " kan verwijzen naar:"

    return r
end

return p