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 17:39, 25 May 2025 (next is one of the Lua scripting language). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- Introduction: Pagination primarily contains two buttons, a next and a previous button
local p = {}
function p.pagination(frame)
 args = frame.args
 previous = args[1] or args.previous
 nextEl = args[2] or args.next
 msg = 'PaginationScriptError: You must provide a link for the'
 tmp = '<div id="pagination"><div class="prev-btn">[[' .. previous .. '|Previous]]</div> <div class="next-btn">[[' .. nextEl .. '|Next]]</div></div>'
if previous == '' and nextEl == '' then
 return string.format(error(msg 'previous and next buttons'))
else return tmp
end
if previous == '' then
 return string.format(error(msg 'previous button'))
else return tmp
end
if nextEl == '' then
 return string.format(error(msg 'next button'))
else return tmp
end

end
return p