lib/pagy/extras/trim.rb in pagy-4.10.1 vs lib/pagy/extras/trim.rb in pagy-4.10.2
- old
+ new
@@ -12,11 +12,15 @@
link_proc = super(pagy, link_extra: link_extra)
return link_proc unless pagy.vars[:enable_trim_extra]
lambda do |num, text=num, extra=''|
link = +link_proc.call(num, text, extra)
return link unless num == 1
- link.sub!(/[?&]#{pagy.vars[:page_param]}=1\b(?!&)|\b#{pagy.vars[:page_param]}=1&/, '')
+ pagy_trim(pagy, link)
end
+ end
+
+ def pagy_trim(pagy, link)
+ link.sub!(/[?&]#{pagy.vars[:page_param]}=1\b(?!&)|\b#{pagy.vars[:page_param]}=1&/, '')
end
end
Frontend.prepend UseTrimExtra