j1-paginator 2020.0.1 → 2021.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0291abd44383e8a8cd7c9d40e476570c0c0649989df9d07d1653854264fafed9'
4
- data.tar.gz: 026e9ae32361a02400bb54da216a249f05d84500a1242306ecefca76f1d4a01e
3
+ metadata.gz: bf74f1bba29c33242d08fb9734ecddc619c7506473c334e0a8707c5e3682445c
4
+ data.tar.gz: f090acdcaa7691776d8b3f6b46fb579a978c5176bcc529475fda69483450d2b6
5
5
  SHA512:
6
- metadata.gz: 426524d6cf68b4a429dc9dbaf2558f1868d145332542add93d3833f8dded0bd45d92f8112c8cd3c62bd1f500cdfb35af345253434c84b5b4bd1f5b661daec47d
7
- data.tar.gz: 84508d62b690e53fd56de1ec14b7813169d5b08997c6b92ce54ceccc60e1d82f5857c0dfe54905db6967783e4c2d55f5b12d49781ee26c0e4052a879b0abb181
6
+ metadata.gz: 86d5e86ddee5e965afecf4d40821aea07f3b43f2736bb0ea8632368a0f6205a304047a858db51549aadbd6827dd93b6de0c308a05fd69d217fa4ff97c156714c
7
+ data.tar.gz: 65ed6b9de9139909302e44c0175466ae97bd8f60c3de033c5d51f6bd52b6070b5c8afc93438a53bb6104f076ddd5bfdabce7dd37bce62577d0fd0411a9bf574a
data/j1-paginator.gemspec CHANGED
@@ -17,18 +17,19 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.summary = %q{Pagination Generator for Jekyll 3}
19
19
  spec.description = %q{An enhanced zero-configuration in-place replacement for the now decomissioned built-in jekyll-paginate gem. This pagination gem offers full backwards compatability as well as a slew of new frequently requested features with minimal additional site and page configuration. Optional features include auto-generation of paginated collection, tag and category pages.}
20
-
20
+
21
21
  spec.files = Dir['CODE_OF_CONDUCT.md', 'README*.md', 'LICENSE', 'Rakefile', '*.gemspec', 'Gemfile', 'lib/**/*', 'spec/**/*']
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  # Gem requires Jekyll to work
26
26
  # ~> is the pessimistic operator and is equivalent to '>= 3.0', '< 4.0'
27
- #spec.add_runtime_dependency "jekyll", "~> 3.0"
28
- spec.add_runtime_dependency "jekyll", '>= 3.0', '<= 4.0'
27
+ # spec.add_runtime_dependency "jekyll", '>= 3.0', '<= 4.0
28
+ # spec.add_runtime_dependency "jekyll", '> 3.0'
29
+ spec.add_runtime_dependency 'jekyll', '>= 3.6', '< 5.0'
29
30
 
30
31
  # Development requires more
31
32
  spec.add_development_dependency "bundler", "~> 2.0"
32
33
  spec.add_development_dependency "rake", "~> 13.0" # Fix rake vulnerability of CVE-2020-8130
33
34
  spec.add_development_dependency "minitest", '~> 5.4'
34
- end
35
+ end
data/lib/j1-paginator.rb CHANGED
@@ -1,8 +1,9 @@
1
- # Jekyll::Paginate V2 is a gem built for Jekyll 3 that generates pagiatation for posts, collections, categories and tags.
2
- #
3
- # It is based on https://github.com/jekyll/jekyll-paginate, the original Jekyll paginator
4
- # which was decommissioned in Jekyll 3 release onwards. This code is currently not officially
5
- # supported on Jekyll versions < 3.0 (although it might work)
1
+ # Jekyll::Paginate V2 is a gem built for Jekyll 4+ that generates
2
+ # pagiatation for posts, collections, categories and tags.
3
+ #
4
+ # It is based on https://github.com/jekyll/jekyll-paginate, the original
5
+ # Jekyll paginator which was decommissioned in Jekyll 3 release onwards.
6
+ # This code is currently not officially supported on Jekyll versions >= 3.0.
6
7
  #
7
8
  # Author: Sverrir Sigmundarson
8
9
  # Site: https://github.com/sverrirs/j1-paginator
@@ -28,7 +29,7 @@ require "j1-paginator/autopages/pages/categoryAutoPage"
28
29
  require "j1-paginator/autopages/pages/collectionAutoPage"
29
30
  require "j1-paginator/autopages/pages/tagAutoPage"
30
31
 
31
- module Jekyll
32
+ module Jekyll
32
33
  module J1Paginator
33
34
  end # module J1Paginator
34
- end # module Jekyll
35
+ end # module Jekyll
@@ -12,7 +12,7 @@ module Jekyll
12
12
  pg_settings = Jekyll::Utils.deep_merge_hashes(pg_config_defaults, pg_config_settings || {})
13
13
 
14
14
  # Get the configuration for auto pages
15
- ap_config_defaults = pg_config_defaults['settings']['autopages']
15
+ ap_config_defaults = pg_config_defaults['defaults']['autopages']
16
16
  ap_config_settings = pg_config_settings['settings']['autopages']
17
17
  ap_settings = Jekyll::Utils.deep_merge_hashes(ap_config_defaults, ap_config_settings || {})
18
18
 
@@ -21,7 +21,7 @@ module Jekyll
21
21
 
22
22
 
23
23
  # Get the configuration for the paginator
24
- pg_config_defaults = pg_config_defaults['settings']['pagination']
24
+ pg_config_defaults = pg_config_defaults['defaults']['pagination']
25
25
  pg_config_settings = pg_config_settings['settings']['pagination']
26
26
  pg_settings = Jekyll::Utils.deep_merge_hashes(pg_config_defaults, pg_config_settings || {})
27
27
 
@@ -49,7 +49,7 @@ module Jekyll
49
49
  site.pages << TagAutoPage.new(site, site.dest, autopage_tag_config, pagination_config, layout_name, tag, tag_original_name)
50
50
  end
51
51
  autopage_create(autopage_config, pagination_config, posts_to_use, 'tags', 'tags', createtagpage_lambda) # Call the actual function
52
-
52
+
53
53
 
54
54
  ###############################################
55
55
  # Generate the category pages if enabled
@@ -57,14 +57,14 @@ module Jekyll
57
57
  site.pages << CategoryAutoPage.new(site, site.dest, autopage_cat_config, pagination_config, layout_name, category, category_original_name)
58
58
  end
59
59
  autopage_create(autopage_config, pagination_config,posts_to_use, 'categories', 'categories', createcatpage_lambda) # Call the actual function
60
-
60
+
61
61
  ###############################################
62
62
  # Generate the Collection pages if enabled
63
63
  createcolpage_lambda = lambda do | autopage_col_config, pagination_config, layout_name, coll_name, coll_original_name |
64
64
  site.pages << CollectionAutoPage.new(site, site.dest, autopage_col_config, pagination_config, layout_name, coll_name, coll_original_name)
65
65
  end
66
66
  autopage_create(autopage_config, pagination_config,posts_to_use, 'collections', '__coll', createcolpage_lambda) # Call the actual function
67
-
67
+
68
68
  end # create_autopages
69
69
 
70
70
  # STATIC: this function actually performs the steps to generate the autopages.
@@ -13,9 +13,9 @@ module Jekyll
13
13
  'sort_reverse' => false,
14
14
  'sort_field' => 'date',
15
15
  'limit' => 0, # Limit how many content objects to paginate (default: 0, means all)
16
- 'trail' => {
17
- 'before' => 0, # Limits how many links to show before the current page in the pagination trail (0, means off, default: 0)
18
- 'after' => 0, # Limits how many links to show after the current page in the pagination trail (0 means off, default: 0)
16
+ 'trail' => {
17
+ 'before' => 0, # Limits how many links to show before the current page in the pagination trail (0, means off, default: 0)
18
+ 'after' => 0, # Limits how many links to show after the current page in the pagination trail (0 means off, default: 0)
19
19
  },
20
20
  'indexpage' => 'index', # The default name of the index pages
21
21
  'extension' => 'html', # The default extension for the output pages (ignored if indexpage is nil)
@@ -24,4 +24,4 @@ module Jekyll
24
24
  }
25
25
 
26
26
  end # module J1Paginator
27
- end # module Jekyll
27
+ end # module Jekyll
@@ -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 PaginationV2
425
+ end # class PaginationModel
405
426
 
406
427
  end # module J1Paginator
407
- end # module Jekyll
428
+ end # module Jekyll
@@ -1,10 +1,5 @@
1
1
  module Jekyll
2
2
  module J1Paginator
3
- VERSION = "2020.0.1"
4
- # When modifying remember to issue a new tag command in git before committing, then push the new tag
5
- # git tag -a v2.1.0 -m "Gem v2.1.0"
6
- # git push origin --tags
7
- # Yanking a published Gem
8
- # gem yank j1-paginator -v VERSION
9
- end # module J1Paginator
10
- end # module Jekyll
3
+ VERSION = '2021.1.1'
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: j1-paginator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2020.0.1
4
+ version: 2021.1.1
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: 2020-06-13 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
20
- - - "<="
19
+ version: '3.6'
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4.0'
22
+ version: '5.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '3.0'
30
- - - "<="
29
+ version: '3.6'
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4.0'
32
+ version: '5.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -117,7 +117,7 @@ homepage: https://github.com/sverrirs/j1-paginator
117
117
  licenses:
118
118
  - MIT
119
119
  metadata: {}
120
- post_install_message:
120
+ post_install_message:
121
121
  rdoc_options: []
122
122
  require_paths:
123
123
  - lib
@@ -132,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.0.3
136
- signing_key:
135
+ rubygems_version: 3.1.4
136
+ signing_key:
137
137
  specification_version: 4
138
138
  summary: Pagination Generator for Jekyll 3
139
139
  test_files: