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:53, 25 May 2025 (spaced). 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 = '<strong class="error">PaginationScriptError: You must provide a link for the</strong>'
 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('<strong class="error">' .. msg .. ' previous and next buttons</strong>')
else return tmp
end
if previous == '' then
 return string.format('<strong class="error">' .. msg .. ' previous button</strong>')
else return tmp
end
if nextEl == '' then
 return string.format('<strong class="error">' .. msg .. ' next button</strong>')
else return tmp
end

end
return p