Difference between revisions of "Module:Redirect and target"

From blackwiki
Jump to navigation Jump to search
test>Rich Farmbrough
(Created page with 'local getTarget = require('Module:Redirect').getTarget local p = {} local function pagetype(nsText) return nsText == '' and 'articles' or (mw.ustring.lower(nsT...')
 
test>Rich Farmbrough
((Based on code by Jackmcbarn))
Line 1: Line 1:
 
local getTarget = require('Module:Redirect').getTarget
 
local getTarget = require('Module:Redirect').getTarget
 
local p = {}
 
local p = {}
 
local function pagetype(nsText)
 
return nsText == '' and 'articles' or (mw.ustring.lower(nsText) .. ' pages')
 
end
 
  
 
function p.main(frame)
 
function p.main(frame)
local pageTitle = mw.ustring.toNFC (frame.args[1])
+
local pageTitle = frame.args[1]
 
local target = getTarget(pageTitle)
 
local target = getTarget(pageTitle)
 
if target then
 
if target then

Revision as of 17:27, 29 January 2016

Documentation for this module may be created at Module:Redirect and target/doc

local getTarget = require('Module:Redirect').getTarget
local p = {}

function p.main(frame)
	local pageTitle = frame.args[1]
	local target = getTarget(pageTitle)
	if target then
   	        return string.format('[[%s]] → [[%s]]', pageTitle, target)
	end
	return string.format('[[%s]] is not a redirect', pageTitle)
end

return p