Jump to content

Module:Pagination

From Wikipedia, the free encyclopedia

local p = {}
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
 msg = {
nopreviousLink = 'no link for the previous button ([[template:Pagination#Errors|help]])',
nonextLink = 'no link for the next button ([[template:Pagination#Errors|help]])',
noLink = 'no link for both the previous and next buttons ([[template:Pagination#Errors|help]])'
}
 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 == '' then
 return string.format('<strong class="error">"PaginationScriptError: %s"</strong>', msg.noLink)
else
 return pn
end 

end
return p