มอดูล:Redirect and target
![Documentation icon](http://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png)
คุณอาจจะต้องการสร้างคู่มือการใช้งานของมอดูลนี้ ผู้เขียนสามารถทำการทดลองได้ที่กระบะทราย (สร้าง | คัดลอก) และชุดทดสอบ (สร้าง) ของมอดูลนี้ โปรดเพิ่มหมวดหมู่ไปที่หน้าย่อย /doc หน้าย่อยของมอดูลนี้ |
local getTarget = require('Module:Redirect').getTarget
local p = {}
function p.line(frame)
local pageTitle = frame.args[1]
local target = getTarget(pageTitle, true)
if target then
return string.format('[[%s]] → [[%s]]', pageTitle, target)
end
return string.format('[[%s]] is not a redirect', pageTitle)
end
function p.report(frame)
local pageTitle = frame.args[1]
local target = getTarget(pageTitle, true)
if target then
return string.format('<i>[[%s]] (R)</i> → [[%s]]', pageTitle, target)
end
return string.format('[[%s]]', pageTitle)
end
return p