Jump to content

Module:Pagination

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Codemini (talk | contribs) at 07:39, 3 July 2025 (...). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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)
       local args = getArgs(frame)
       return p._pagination(args)
end

function p._pagination(args)
      prevstyle = args.prevcolor or ''
      nextstyle = args.nextcolor or ''
      prevlink = args[1] or args.prevlink
      nextlink = args[2] or args.nextlink
 p = '<span class="prev-btn" style="' .. prevstyle .. ';>[[' .. prevlink .. '|Previous]]</span>'
 n = '<span class="next-btn" style="' .. nextstyle .. ';>[[' .. nextlink .. '|Next]]</span>'
 pn = '' .. p .. ' ' .. n .. ''
if prevlink and nextlink == '' or nil then
 return makeWikitextError('no link provided for the previous and next buttons')
else
 return pn
end 

end
return p