Jump to content

Module:Pagination: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Codemini (talk | contribs)
New problem
Codemini (talk | contribs)
O boy, am worn out
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 = '<div id="pagination"><span class="prev-btn" style="background-color: ' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</span></div>'
p = '<span class="prev-btn" style="background-color: ' .. prevcolor .. ';>[[' .. previous .. '|Previous]]</span>'
n = '<div id="pagination"><span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span></div>'
n = '<span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>'
hide = args.hide or ''
hide = args.hide or ''
pn = p and 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 p and n
end
end
if hide == 'previous' then
if hide == 'previous' then
return n
return n
else
else
return pn
return p and n
end
end
if hide == 'next' then
if hide == 'next' then
return p
return p
else
else
return pn
return p and n
end
end


end
end

Revision as of 08:38, 26 May 2025

local p = {}
function p.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>'
 n = '<span class="next-btn" style="background-color: ' .. nextcolor .. ';>[[' .. nextEl .. '|Next]]</span>'
 hide = args.hide or ''
if previous == '' and nextEl == '' then
 return '<strong class="error">' .. msg .. ' previous and next buttons</strong>'
else
 return p and n
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
return p