Module:Pagination: Difference between revisions
Appearance
Content deleted Content added
Later some more powerful experts should work on this |
Todo done |
||
Line 7: | Line 7: | ||
nextEl = args[2] or args.next |
nextEl = args[2] or args.next |
||
msg = '<strong class="error">PaginationScriptError: You must provide a link for the</strong>' |
msg = '<strong class="error">PaginationScriptError: You must provide a link for the</strong>' |
||
p = '<span class="prev-btn" style="background-color: ' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</span>' |
|||
if not previous then |
|||
return n |
|||
elseif not nextEl then |
|||
return p |
|||
else return pn |
|||
end |
|||
n = '<span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>' |
|||
pn = '' .. p .. '' .. n .. '' |
|||
if previous == '' and nextEl == '' then |
if previous == '' and nextEl == '' then |
||
return '<strong class="error">' .. msg .. ' previous and next buttons</strong>' |
return '<strong class="error">' .. msg .. ' previous and next buttons</strong>' |
||
else |
else |
||
return pn |
return pn |
||
end |
end |
||
--[[ if hide == 'previous' then |
|||
return n |
|||
else |
|||
return p and n |
|||
end |
|||
if hide == 'next' then |
|||
return p |
|||
else |
|||
return p and n |
|||
end --]] |
|||
end |
end |
Revision as of 18:54, 29 May 2025
![]() | This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
Implements {{Pagination}}
Usage
{{#invoke:Pagination|pagination}}
local pk = {}
function pk.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 = '<strong class="error">PaginationScriptError: You must provide a link for the</strong>'
p = '<span class="prev-btn" style="background-color: ' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</span>'
if not previous then
return n
elseif not nextEl then
return p
else return pn
end
n = '<span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>'
pn = '' .. p .. '' .. n .. ''
if previous == '' and nextEl == '' then
return '<strong class="error">' .. msg .. ' previous and next buttons</strong>'
else
return pn
end
end
return pk