Jump to content

Module:Pagination

From Simple English Wikipedia, the free encyclopedia
Revision as of 20:42, 2 July 2025 by Codemini (talk | changes) (Undid revision 10368236 by Codemini (talk).)

Implements {{Pagination}}


local p = {}
local getArgs = require('Module:Arguments').getArgs
local function makeWikitextError(msg)
 return string.format('<strong class="error">PaginationScriptError: "%s" ([[template:Pagination#Errors|help]])</strong>', msg)
end
function p.pagination(frame)
args = getArgs(frame, { wrappers = "Template:Pagination" })
prevlink = args[1] or args.prevlink
nextlink = args[2] or args.nextlink
prevstyle = args.prevstyle or ''
nextstyle = args.nextstyle or ''
p = '<span class="prev-btn" style="' .. prevstyle .. '";>[[' .. prevlink .. '|Previous]]</span>'
n = '<span class="next-btn" style="' .. nextstyle .. '";>[[' .. nextlink .. '|Next]]</span>'
pntm = '' .. p .. ' ' .. n .. ''
if prevlink and nextlink == '' then
return makeWikitextError('no link provided for the previous and next buttons') else return pntm
end
end
return p