Jump to content

Module:Pagination

From Wikipedia, the free encyclopedia

local p = {}
local function makeWikitextError(msg)
 return string.format('<strong class="error">PaginationScriptError: "%s" ([[template:Pagination#Errors|help]])</strong>', msg)
end
function p.pagination(frame)
 args = frame.args
 prevstyle = args.prevcolor or ''
 nextstyle = args.nextcolor or ''
 prevlink = args[1] or args.previous
 nextlink = args[2] or args.next
 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