Jump to content

Module:Pagination

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Codemini (talk | contribs) at 15:58, 1 June 2025 (In accordance with the code at simple english wiki). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}
local function makeWikitextError(msg)
 return error(string.format('PaginationScriptError: "%s" ([[template:Pagination#Errors|help]])', msg), 2)
end
function p.pagination(frame)
 args = frame.args
 prevcolor = args.prevcolor or ''
 nextcolor = args.nextcolor or ''
 previous = args[1] or args.previous
 nextEl = args[2] or args.next
 p = '<span class="prev-btn" style="background-color: ' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</span>'
 n = '<span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>'
 pn = '' .. p .. ' ' .. n .. ''
if previous and nextEl == '' or nil then
 return makeWikitextError('no link provided for the previous and next buttons')
else
 return pn
end 

end
return p