Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 

















Module:Redirect-multi






تۆرکجه

Bosanski
Español
فارسی
ГӀалгӀай

ि
Ilokano
Kurdî

Монгол



Русский

Scots

Simple English
Slovenščina
کوردی
Српски / srpski

Tiếng Vit


 

Edit links
 









Module
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 





Permanently protected module

From Wikipedia, the free encyclopedia
 


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

Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Redirect-multi&oldid=815611106"

Category: 
Hatnote modules
Hidden category: 
Wikipedia template-protected modules
 



This page was last edited on 15 December 2017, at 22:32 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki