Jump to content

Module:Other people

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Nihiltres (talk | contribs) at 17:25, 14 May 2016 (Implements Template:Other people in Lua, with enhancement of supporting multiple disambiguation pages). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local mOtheruses = require('Module:Other uses')
local mArguments = require('Module:Arguments')
local p = {}

function p.otherPeople (frame)
	--Get arguments and simply compress the array while preserving named args
	--and gaps below 2
	local origArgs = mArguments.getArgs(frame)
	local args = {}
	for k, v in pairs(origArgs) do
		if type(k) == 'number' and k > 1 then
			args[math.max(table.maxn(args) + 1, 2)] = v
		else
			args[k] = v
		end
	end
	-- Assemble arguments and return
	local options = {
		title = args[1] or mw.title.getCurrentTitle().text,
		otherText = args[1] and
			string.format('people %s %s', args.named or 'named', args[1]) or
			'people with the same name'
	}
	table.remove(args, 1) -- Don't pass args[1] through as a target page
	return mOtheruses._otheruses(args, options)
end

return p