bridgetown-paginate 0.21.4 → 1.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b71e882e5543a240bc6a6f628ad81c4d93fd09f4df967a2add259a9b18fc6fae
4
- data.tar.gz: e5ccdab51aa1c522d611f934f8cbd1d031424a1e553c11b2b943dcede0a8aa6a
3
+ metadata.gz: 1503605e813afc4d2b3fa331033a8a2f6a41066a88cf83432eb065e93c5fbdb0
4
+ data.tar.gz: e8078cbed32a2d3b6af6044dae34944d4019935865edda9d222fb03779296c79
5
5
  SHA512:
6
- metadata.gz: e7a73d861b11556dca0a1018759ae80034b70c64a3b4efcf3c76cbaf6ba64a6caed19c34d434eb8889b1f8fd0152c4012a0b2add70581e66204fa7d83c9f2609
7
- data.tar.gz: b7ea940094a639ca9ac7aa669e049aa625fc19d7c1e335d3f5bdb7fff5b0debb82687e8732fa33613007eb89975820bfc9c6a9bb473db6d217ac7433d03eb2d4
6
+ metadata.gz: 3e5fd22e0b2f291ea3be6921134fce48d384b39163b08dfc5f8b63ddc8ba0ca531e44db48b7919bce5c2db2c7799240f5dd19eea309e7962cb83d106be0d9282
7
+ data.tar.gz: 5fefc5e0d4384942edaabac5b26fa97abd260e47b42abc61c0ec6686f92624dceb802e0833058a4208e4470d3383a8ab5914d6c3e5a9018fa0c8f77c238762ca
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.author = "Bridgetown Team"
9
9
  spec.email = "maintainers@bridgetownrb.com"
10
10
  spec.summary = "A Bridgetown plugin to add pagination support for posts and collection indices."
11
- spec.homepage = "https://github.com/bridgetownrb/bridgetown/tree/master/bridgetown-paginate"
11
+ spec.homepage = "https://github.com/bridgetownrb/bridgetown/tree/main/bridgetown-paginate"
12
12
  spec.license = "MIT"
13
13
 
14
14
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features)/!) }
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Handles Generated Pages
4
- Bridgetown::Hooks.register :pages, :post_init, reloadable: false do |page|
4
+ Bridgetown::Hooks.register :generated_pages, :post_init, reloadable: false do |page|
5
5
  if page.class != Bridgetown::Paginate::PaginationPage &&
6
6
  page.site.config.dig("pagination", "enabled")
7
7
  data = page.data.with_dot_access
@@ -32,7 +32,6 @@ module Bridgetown
32
32
  DEFAULT,
33
33
  site.config["pagination"] || {}
34
34
  )
35
- default_config["collection"] = "posts" unless site.uses_resource?
36
35
 
37
36
  # If disabled then simply quit
38
37
  unless default_config["enabled"]
@@ -44,7 +43,7 @@ module Bridgetown
44
43
  Bridgetown.logger.debug "Pagination:", "Starting"
45
44
 
46
45
  # Get all matching pages in the site found by the init hooks, and ensure they're
47
- # still in the site.pages array
46
+ # still in the site.generated_pages array
48
47
  templates = self.class.matching_templates.select do |page|
49
48
  site.generated_pages.include?(page) || site.resources.include?(page)
50
49
  end
@@ -96,7 +95,7 @@ module Bridgetown
96
95
  if page_to_remove.is_a?(Bridgetown::Resource::Base)
97
96
  page_to_remove.collection.resources.delete(page_to_remove)
98
97
  else
99
- site.pages.delete(page_to_remove)
98
+ site.generated_pages.delete(page_to_remove)
100
99
  end
101
100
  end
102
101
 
@@ -12,7 +12,7 @@ module Bridgetown
12
12
  @logging_lambda = nil
13
13
  # The lambda used to create pages and add them to the site
14
14
  @page_add_lambda = nil
15
- # Lambda to remove a page from the site.pages collection
15
+ # Lambda to remove a page
16
16
  @page_remove_lambda = nil
17
17
  # Lambda to get all documents/posts in a particular collection (by name)
18
18
  @collection_by_name_lambda = nil
@@ -352,8 +352,7 @@ module Bridgetown
352
352
 
353
353
  # 3. Create the paginator logic for this page, pass in the prev and next
354
354
  # page numbers, assign paginator to in-memory page
355
- # TODO: remove .pager by v1.0, deprecated
356
- newpage.paginator = newpage.pager = Paginator.new(
355
+ newpage.paginator = Paginator.new(
357
356
  config["per_page"],
358
357
  first_index_page_url,
359
358
  paginated_page_url,
@@ -17,9 +17,8 @@ module Bridgetown
17
17
  @url = ""
18
18
  @name = index_pageandext.nil? ? "index#{template_ext}" : index_pageandext
19
19
  @path = page_to_copy.path
20
-
21
- # Creates the basename and ext member values
22
- process(@name)
20
+ @basename = File.basename(@path, ".*")
21
+ @ext = File.extname(@name)
23
22
 
24
23
  # Only need to copy the data part of the page as it already contains the
25
24
  # layout information
@@ -29,11 +28,7 @@ module Bridgetown
29
28
  # Store the current page and total page numbers in the pagination_info construct
30
29
  data["pagination_info"] = { "curr_page" => cur_page_nr, "total_pages" => total_pages }
31
30
 
32
- # Perform some validation that is also performed in Bridgetown::Page
33
- validate_data! page_to_copy.path
34
- validate_permalink! page_to_copy.path
35
-
36
- Bridgetown::Hooks.trigger :pages, :post_init, self
31
+ Bridgetown::Hooks.trigger :generated_pages, :post_init, self
37
32
  end
38
33
 
39
34
  # rubocop:disable Naming/AccessorMethodName
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-paginate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.4
4
+ version: 1.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-10 00:00:00.000000000 Z
11
+ date: 2021-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.4
19
+ version: 1.0.0.alpha1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.21.4
26
+ version: 1.0.0.alpha1
27
27
  description:
28
28
  email: maintainers@bridgetownrb.com
29
29
  executables: []
@@ -42,7 +42,7 @@ files:
42
42
  - lib/bridgetown-paginate/pagination_page.rb
43
43
  - lib/bridgetown-paginate/paginator.rb
44
44
  - lib/bridgetown-paginate/utils.rb
45
- homepage: https://github.com/bridgetownrb/bridgetown/tree/master/bridgetown-paginate
45
+ homepage: https://github.com/bridgetownrb/bridgetown/tree/main/bridgetown-paginate
46
46
  licenses:
47
47
  - MIT
48
48
  metadata: {}
@@ -57,9 +57,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - ">"
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 1.3.1
63
63
  requirements: []
64
64
  rubygems_version: 3.1.4
65
65
  signing_key: