Jump to content

Module:Pagination: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Codemini (talk | contribs)
Todo done
Codemini (talk | contribs)
Taught this work
Line 8: Line 8:
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>'
p = '<span class="prev-btn" style="background-color: ' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</span>'
if not previous then
--[[ if not previous then
return n
return n
elseif not nextEl then
elseif not nextEl then
return p
return p
else return pn
else return pn
end
end --]]
n = '<span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>'
n = '<span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>'
pn = '' .. p .. '' .. n .. ''
pn = '' .. p .. '' .. n .. ''

Revision as of 18:57, 29 May 2025

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