|
|
(2 intermediate revisions by 2 users not shown) |
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, ...) |
| if success then | | return success and titleObj or nil |
| return titleObj
| |
| else
| |
| return nil
| |
| end
| |
| 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] = '"' .. v .. '"' | | formattedRedirect[k] = mHatnote.quote(v) |
| end | | end |
| local text = { | | local text = { |