Module:Pagination
Appearance
Implements {{Pagination}}
local p = {} -- package name
function p.main(frame)
args = frame.args
previous = args[1] or args.previous or ''
nextEl = args[2] or args.next or ''
prevcolor = args.prevcolor or ''
nextcolor = args.nextcolor or ''
ptm = '<span class="prev-btn" style="background-color:' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</span> '
ntm = '<span class="next-btn" style="background-color:' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>'
hide = args.hide or ''
pntm = '' .. ptm .. '' .. ntm .. ''
if hide == 'previous' then
return ntm
elseif hide == 'next' then
return ptm
else return pntm
end
if previous == '' and nextEl == '' then
return addWarning('PaginationScriptError: You must provide the link for both the previous and next buttons')
else return pntm
end
if mw.title.new(previous).exists == true then
return previous
else return string.format('PaginationScriptError: The link: "%s" for the previous button is not a valid pagename', previous)
end
end
return p