Module:Pagination
Appearance
Implements {{Pagination}}
local p = {}
function p.pagination(frame)
args = frame.args
prevbtn = args[1]
nextbtn = args[2]
msg = { noprevLink = '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]])'
}
prevcolor = args.prevcolor or ''
nextcolor = args.nextcolor or ''
p = '<span class="prev-btn" style="background-color:' .. prevcolor .. '";>[[' .. prevbtn .. '|Previous]]</span>'
n = '<span class="next-btn" style="background-color:' .. nextcolor .. '";>[[' .. nextbtn .. '|Next]]</span>'
pntm = '' .. p .. ' ' .. n .. ''
if prevbtn and nextbtn == '' then
return string.format('<strong class="error">"PaginationScriptError: %s"</strong>', msg.noLink, help) else return pntm
end
if prevbtn == '' then
return string.format('<strong class="error">"PaginationScriptError: %s"</strong>', msg.noprevLink) else return pntm
end
end
return p