Open main menu
Home
Random
Log in
Settings
About Chabadpedia
Chabadpedia
Search
Editing
Module:Redirect-multi
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local mRedirectHatnote = require('Module:Redirect hatnote') local mArguments = require('Module:Arguments') local mHatnote = require('Module:Hatnote') local p = {} function p.redirectMulti (frame) local args = mArguments.getArgs(frame) --Get maxArg manually because getArgs and table.maxn aren't friends local maxArg = 0 for k, v in pairs(args) do if type(k) == 'number' and k > maxArg then maxArg = k end end --Get number of redirects then remove it from the args table local numRedirects = tonumber(args[1]) or 1 --Manual downshift of arguments; not using table.remove because getArgs is --gnarly and it's not a sequence anyway for i = 2, maxArg + 1 do args[i - 1] = args[i] end --if no arguments past redirects exist, add in a default set if maxArg - 2 <= numRedirects then for i = 1, numRedirects do args[numRedirects + (2 * i)] = args[i] and mHatnote.disambiguate(args[i]) --this does add in an "and" after the last item, but it's ignored args[numRedirects + (2 * i) + 1] = 'and' end end local options = {selfref = args.selfref} return mRedirectHatnote._redirect(args, numRedirects, options) end return p
Edit summary
(Briefly describe your changes)
Please note that all contributions to Chabadpedia are considered to be released under the GNU Free Documentation License 1.3 or later (see
Chabadpedia:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Debug console
* The module exports are available as the variable "p", including unsaved modifications. * Precede a line with "=" to evaluate it as an expression or use print(). Use mw.logObject() for tables. * Use mw.log() and mw.logObject() in module code to send messages to this console.
Template used on this page:
Module:Redirect-multi/doc
(
edit
)