j1-paginator 2020.0.3 → 2021.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/j1-paginator.gemspec +2 -2
- data/lib/j1-paginator/generator/paginationModel.rb +35 -14
- data/lib/j1-paginator/version.rb +1 -1
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 865c3980e0c22c262396c3f33aa3b65fce731ade700cf278d276c9f4bb1b7041
|
4
|
+
data.tar.gz: 06ea8a1a2301c6e0b0f8710fe6d76403da6c7c394d1e593a8268a0948478bf7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 446392e22ef0e3af071bf3250b03f083556cfe856b833362bc4aa25b0454ec6057362992defbb5caba41547e34bfb7425cffa6fa41fb0be3a167010342b07eb2
|
7
|
+
data.tar.gz: d716686bf92c6820af619c65a01c791d321747666ef61c29410376534bbc0956eabda491d3ba986cd460478e58cbc809da71ac831ec3065ac9cba238eb0951bf
|
data/j1-paginator.gemspec
CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
# Gem requires Jekyll to work
|
26
26
|
# ~> is the pessimistic operator and is equivalent to '>= 3.0', '< 4.0'
|
27
27
|
# spec.add_runtime_dependency "jekyll", '>= 3.0', '<= 4.0
|
28
|
-
spec.add_runtime_dependency "jekyll", '> 3.0'
|
29
|
-
|
28
|
+
# spec.add_runtime_dependency "jekyll", '> 3.0'
|
29
|
+
spec.add_runtime_dependency 'jekyll', '>= 3.6', '< 5.0'
|
30
30
|
|
31
31
|
# Development requires more
|
32
32
|
spec.add_development_dependency "bundler", "~> 2.0"
|
@@ -45,7 +45,7 @@ module Jekyll
|
|
45
45
|
@debug = template_config['debug']
|
46
46
|
|
47
47
|
self._debug_print_config_info(template_config, template.path)
|
48
|
-
|
48
|
+
|
49
49
|
# Only paginate the template if it is explicitly enabled
|
50
50
|
# This makes the logic simpler by avoiding the need to determine
|
51
51
|
# which index pages were generated automatically and which weren't
|
@@ -139,7 +139,7 @@ module Jekyll
|
|
139
139
|
def _fix_deprecated_config_features(config)
|
140
140
|
keys_to_delete = []
|
141
141
|
|
142
|
-
# As of v1.5.1 the title_suffix is deprecated and 'title' should be used
|
142
|
+
# As of v1.5.1 the title_suffix is deprecated and 'title' should be used
|
143
143
|
# but only if title has not been defined already!
|
144
144
|
if( !config['title_suffix'].nil? )
|
145
145
|
if( config['title'].nil? )
|
@@ -203,7 +203,7 @@ module Jekyll
|
|
203
203
|
before_count = before_count.to_s.rjust(3)
|
204
204
|
_debug_log " Filtering by #{filter_name}", "#{before_count} => #{after_count}"
|
205
205
|
end
|
206
|
-
|
206
|
+
|
207
207
|
#
|
208
208
|
# Rolls through all the pages passed in and finds all pages that have
|
209
209
|
# pagination enabled on them. These pages will be used as templates
|
@@ -221,7 +221,7 @@ module Jekyll
|
|
221
221
|
end
|
222
222
|
return candidates
|
223
223
|
end # function discover_paginate_templates
|
224
|
-
|
224
|
+
|
225
225
|
# Paginates the blog's posts. Renders the index.html file into paginated
|
226
226
|
# directories, e.g.: page2/index.html, page3/index.html, etc and adds more
|
227
227
|
# site-wide data.
|
@@ -233,7 +233,7 @@ module Jekyll
|
|
233
233
|
def paginate(template, config, site_title, all_posts, all_tags, all_categories, all_locales)
|
234
234
|
# By default paginate on all posts in the site
|
235
235
|
using_posts = all_posts
|
236
|
-
|
236
|
+
|
237
237
|
# Now start filtering out any posts that the user doesn't want included in the pagination
|
238
238
|
before = using_posts.size
|
239
239
|
using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'category', using_posts, all_categories)
|
@@ -244,7 +244,7 @@ module Jekyll
|
|
244
244
|
before = using_posts.size
|
245
245
|
using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'locale', using_posts, all_locales)
|
246
246
|
self._debug_print_filtering_info('Locale', before, using_posts.size)
|
247
|
-
|
247
|
+
|
248
248
|
# Apply sorting to the posts if configured, any field for the post
|
249
249
|
# is available for sorting
|
250
250
|
if config['sort_field']
|
@@ -283,11 +283,11 @@ module Jekyll
|
|
283
283
|
using_posts.reverse!
|
284
284
|
end
|
285
285
|
end
|
286
|
-
|
286
|
+
|
287
287
|
# Calculate the max number of pagination-pages based on the configured
|
288
288
|
# per page value
|
289
289
|
total_pages = Utils.calculate_number_of_pages(using_posts, config['per_page'])
|
290
|
-
|
290
|
+
|
291
291
|
# If a upper limit is set on the number of total pagination pages
|
292
292
|
# then impose that now
|
293
293
|
if config['limit'] && config['limit'].to_i > 0 && config['limit'].to_i < total_pages
|
@@ -296,7 +296,7 @@ module Jekyll
|
|
296
296
|
|
297
297
|
#### BEFORE STARTING REMOVE THE TEMPLATE PAGE FROM THE SITE LIST!
|
298
298
|
@page_remove_lambda.call( template )
|
299
|
-
|
299
|
+
|
300
300
|
# list of all newly created pages
|
301
301
|
newpages = []
|
302
302
|
|
@@ -321,11 +321,31 @@ module Jekyll
|
|
321
321
|
# construct the title, set all page.data values needed
|
322
322
|
first_index_page_url = Utils.validate_url(template)
|
323
323
|
paginated_page_url = File.join(first_index_page_url, config['permalink'])
|
324
|
-
|
324
|
+
|
325
325
|
# 3. Create the pager logic for this page, pass in the prev and
|
326
326
|
# next page numbers, assign pager to in-memory page
|
327
327
|
newpage.pager = Paginator.new( config['per_page'], first_index_page_url, paginated_page_url, using_posts, cur_page_nr, total_pages, indexPageName, indexPageExt)
|
328
328
|
|
329
|
+
# Disabled for now
|
330
|
+
if cur_page_nr > 10000000000000
|
331
|
+
pagination_path = newpage.instance_variable_get(:@site).instance_variable_get(:@dest)
|
332
|
+
last_pagination_page = newpage.instance_variable_get(:@pager).instance_variable_get(:@last_page_path)
|
333
|
+
last_pagination_file = pagination_path + last_pagination_page
|
334
|
+
|
335
|
+
if config['rebuild'] == false
|
336
|
+
if File.exist?(last_pagination_file)
|
337
|
+
Jekyll.logger.info 'J1 Paginator:', 'recreate pagination pages disabled.'
|
338
|
+
#
|
339
|
+
# TODO: Keep the existing pager file|s from being cleaned by Jekyll
|
340
|
+
#
|
341
|
+
# Add the page to the site
|
342
|
+
@page_add_lambda.call( newpage )
|
343
|
+
newpages << newpage
|
344
|
+
return
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
329
349
|
# Create the url for the new page, make sure we prepend any
|
330
350
|
# permalinks that are defined in the template page before
|
331
351
|
pager_path = newpage.pager.page_path
|
@@ -344,6 +364,7 @@ module Jekyll
|
|
344
364
|
end
|
345
365
|
|
346
366
|
# Transfer the title across to the new page
|
367
|
+
#
|
347
368
|
tmp_title = template.data['title'] || site_title
|
348
369
|
if cur_page_nr > 1 && config.has_key?('title')
|
349
370
|
# If the user specified a title suffix to be added then let's
|
@@ -359,7 +380,7 @@ module Jekyll
|
|
359
380
|
if cur_page_nr > 1
|
360
381
|
newpage.data['autogen'] = "j1-paginator"
|
361
382
|
end
|
362
|
-
|
383
|
+
|
363
384
|
# Add the page to the site
|
364
385
|
@page_add_lambda.call( newpage )
|
365
386
|
|
@@ -388,7 +409,7 @@ module Jekyll
|
|
388
409
|
if( idx_end - idx_start < trail_length )
|
389
410
|
# Attempt to pad the beginning if we have enough pages
|
390
411
|
idx_start = [idx_start - ( trail_length - (idx_end - idx_start) ), 0].max # Never go beyond the zero index
|
391
|
-
end
|
412
|
+
end
|
392
413
|
|
393
414
|
# Convert the newpages array into a two dimensional array
|
394
415
|
# that has [index, page_url] as items
|
@@ -401,7 +422,7 @@ module Jekyll
|
|
401
422
|
|
402
423
|
end # function paginate
|
403
424
|
|
404
|
-
end # class
|
425
|
+
end # class PaginationModel
|
405
426
|
|
406
427
|
end # module J1Paginator
|
407
|
-
end # module Jekyll
|
428
|
+
end # module Jekyll
|
data/lib/j1-paginator/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: j1-paginator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2021.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sverrir Sigmundarson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.6'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.6'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,7 +117,7 @@ homepage: https://github.com/sverrirs/j1-paginator
|
|
111
117
|
licenses:
|
112
118
|
- MIT
|
113
119
|
metadata: {}
|
114
|
-
post_install_message:
|
120
|
+
post_install_message:
|
115
121
|
rdoc_options: []
|
116
122
|
require_paths:
|
117
123
|
- lib
|
@@ -126,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
132
|
- !ruby/object:Gem::Version
|
127
133
|
version: '0'
|
128
134
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
130
|
-
signing_key:
|
135
|
+
rubygems_version: 3.1.4
|
136
|
+
signing_key:
|
131
137
|
specification_version: 4
|
132
138
|
summary: Pagination Generator for Jekyll 3
|
133
139
|
test_files:
|