Module:Redirect hatnote: Difference between revisions
Jump to navigation
Jump to search
Richardpruen (talk | contribs) m (1 revision imported) |
(Updated from sandbox: Migrated p._quote to Module:Hatnote) |
||
Line 13: | Line 13: | ||
local p = {} | local p = {} | ||
-------------------------------------------------------------------------------- | |||
-- Helper functions | |||
-------------------------------------------------------------------------------- | |||
local function getTitle(...) | local function getTitle(...) | ||
--Calls mw.title.new and returns either a title object, or nil on error | |||
local success, titleObj = pcall(mw.title.new, ...) | local success, titleObj = pcall(mw.title.new, ...) | ||
return success and titleObj or nil | |||
end | end | ||
-------------------------------------------------------------------------------- | |||
-- Main functions | |||
-------------------------------------------------------------------------------- | |||
function p.redirect(frame) | function p.redirect(frame) | ||
Line 59: | Line 64: | ||
local formattedRedirect = {} | local formattedRedirect = {} | ||
for k,v in pairs(redirect) do | for k,v in pairs(redirect) do | ||
formattedRedirect[k] = | formattedRedirect[k] = mHatnote.quote(v) | ||
end | end | ||
local text = { | local text = { |