Module:Other people: Difference between revisions
Appearance
Content deleted Content added
Implements Template:Other people in Lua, with enhancement of supporting multiple disambiguation pages |
Tweaked defaulting pattern to match the template better |
||
Line 16: | Line 16: | ||
end |
end |
||
-- Assemble arguments and return |
-- Assemble arguments and return |
||
local title = args[1] or mw.title.getCurrentTitle().text |
|||
local options = { |
local options = { |
||
title = |
title = title, |
||
otherText = args[1] and |
otherText = (args[2] and not args[1] and 'people with the same name') or |
||
string.format('people %s %s', args.named or 'named', |
string.format('people %s %s', args.named or 'named', title) |
||
'people with the same name' |
|||
} |
} |
||
table.remove(args, 1) -- Don't pass args[1] through as a target page |
table.remove(args, 1) -- Don't pass args[1] through as a target page |
Revision as of 17:41, 14 May 2016
Implements {{other people}}.
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 title = args[1] or mw.title.getCurrentTitle().text
local options = {
title = title,
otherText = (args[2] and not args[1] and 'people with the same name') or
string.format('people %s %s', args.named or 'named', title)
}
table.remove(args, 1) -- Don't pass args[1] through as a target page
return mOtheruses._otheruses(args, options)
end
return p