bridgetown-paginate 0.20.0 → 0.21.0

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: 3065f58ab8318220ef8bd61ea6f96bb093ecdc1e3743f4d6a17f455d278f0cc0
4
- data.tar.gz: 2f6319d1120d70afcfde19f18d34c6a7201eb75e0801d44640cb55f35dd46c08
3
+ metadata.gz: 108562c7b942bc8c4e1212fe7c6970c024c53508cfca7a30d3dfeaf721f31457
4
+ data.tar.gz: a82352dae39503a166cd2f59bea07dd9374209a667f2ce781c1bdb4aeffd2d6e
5
5
  SHA512:
6
- metadata.gz: 73cbae538916130c049dd7c1f4044150e02ce7558314b835e8e0446874833b863775a9726b64519a3224ee3e3d7c7522984fd3b945b591257adbc3ffb6383b30
7
- data.tar.gz: 573b35021fd706df9be029e6a8946a78860d15a4d2bd2d9bd02053f368e2ebab0217933bcea3a0a16286a55738cc4f828113d0f70683193c23cdb6e477d63d49
6
+ metadata.gz: d58f5898059fd3cb5e2cdc80c0bc5131076d9422bed5cfc156597b049f52c7fb7d1bf8ae174b02943b19bee02e96157a54491e566dd68c8d72827e02e403ceb7
7
+ data.tar.gz: 30f41b0e4a2cdef05ff86f224269a5fffbd85c8ec7ed42873294dcda8f62a60bf993d1e8dab651a46f6ecb8046ccf3f9f0760494876e34eab7aebdd7aeee3306
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Handles Legacy Pages
3
+ # Handles Generated Pages
4
4
  Bridgetown::Hooks.register :pages, :post_init, reloadable: false do |page|
5
5
  if page.class != Bridgetown::Paginate::PaginationPage &&
6
6
  page.site.config.dig("pagination", "enabled")
@@ -21,3 +21,8 @@ Bridgetown::Hooks.register :resources, :post_read, reloadable: false do |page|
21
21
  Bridgetown::Paginate::PaginationGenerator.add_matching_template(page)
22
22
  end
23
23
  end
24
+
25
+ # Ensure sites clear out templates before rebuild
26
+ Bridgetown::Hooks.register :site, :after_reset, reloadable: false do |_site|
27
+ Bridgetown::Paginate::PaginationGenerator.matching_templates.clear
28
+ end
@@ -13,14 +13,13 @@ module Bridgetown
13
13
  # This generator should be passive with regard to its execution
14
14
  priority :lowest
15
15
 
16
- @matching_templates = []
17
-
18
- def self.add_matching_template(template)
19
- @matching_templates << template
16
+ # @return [Set<Bridgetown::Page, Bridgetown::Resource::Base>]
17
+ def self.matching_templates
18
+ @matching_templates ||= Set.new
20
19
  end
21
20
 
22
- class << self
23
- attr_reader :matching_templates
21
+ def self.add_matching_template(template)
22
+ matching_templates << template
24
23
  end
25
24
 
26
25
  # Generate paginated pages if necessary (Default entry point)
@@ -47,7 +46,7 @@ module Bridgetown
47
46
  # Get all matching pages in the site found by the init hooks, and ensure they're
48
47
  # still in the site.pages array
49
48
  templates = self.class.matching_templates.select do |page|
50
- site.pages.include?(page) || site.resources.include?(page)
49
+ site.generated_pages.include?(page) || site.resources.include?(page)
51
50
  end
52
51
 
53
52
  # Get the default title of the site (used as backup when there is no
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.20.0
4
+ version: 0.21.0
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-03-16 00:00:00.000000000 Z
11
+ date: 2021-06-01 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.20.0
19
+ version: 0.21.0
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.20.0
26
+ version: 0.21.0
27
27
  description:
28
28
  email: maintainers@bridgetownrb.com
29
29
  executables: []