Module:Redirect template

From The Pinched Universe
Jump to navigation Jump to search

The documentation for this module is not intended to be hosted on this wiki.

However, you might be able to find it at one of the following locations:

require('Module:No globals')local a={}local b={all={function()return true end},main={0,'[[wp:mainspace|main]]'},help={12,'[[wp:help namespace|help]]'},portal={100,'[[wp:portal|portal]]'},talk={function(c)return c>0 and c%2==1 end,'[[Help:Using talk pages|talk]]'},template={10,'[[wp:template namespace|template]]'},wikipedia={4,'[[wp:project namespace|Wikipedia project]]'},category={14,'[[wp:categorization|category]]'},user={2,'[[wp:user pages|user]]'}}local function d(e,f)if type(f)=='string'then f=f:match('^%s*(.-)%s*$')if f==''then return nil end end;return f end;local function g(h)for i in pairs(b)do if h[i..' category']then return string.format("'''[[:Category:%s|%s]]''': ",h[i..' category'],h.name)end end;return string.format("'''%s''': ",h.name)end;function a.main(j)local h=require('Module:Arguments').getArgs(j,{wrappers='Template:Redirect template',valueFunc=d})local k=mw.title.getCurrentTitle().namespace;local l=h.info and(h.info:find('^[:;#*]',1)==1 or h.info:find('{|',1,true)==1)and'\n'or' 'local m=string.format('\n<div class="rcat %s">\n*%sThis is a redirect%s%s.%s%s</div>',h.class or'',h.name and g(h)or'',h.from and' from '..h.from or'',h.to and' to '..h.to or'',h.info and l or'',h.info or'')for i,n in pairs(b)do if h[i..' category']then if type(n[1])=='function'and n[1](k)or n[1]==k then m=m..string.format('[[Category:%s]]',h[i..' category'])elseif h['other category']then m=m..string.format('[[Category:%s]]',h['other category'])else m=m..j:expandTemplate{title='Incorrect redirect template',args={n[2]}}end end end;if k==0 then local o=require('Module:Yesno')if o(h.printworthy)==true then return m..'[[Category:Printworthy redirects]]'elseif o(h.printworthy)==false then return m..'[[Category:Unprintworthy redirects]]'end end;return m end;return a