bridgetown-paginate 1.0.0.beta2 → 1.1.0.beta1

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: 0e62fa684407f04d71210b75f98af3fd59de77e60b66a1638de5644b9a1344ec
4
- data.tar.gz: 77a89ded7a4b6d4c54e6dbd555328ac37270368ac04aebd2aacd1b626e084340
3
+ metadata.gz: d8d7266c5e0dc1ca064eb708a40837bdc7d2b3ae8110271578e94f47a686f7f4
4
+ data.tar.gz: 4a83ea0e7bd905b8dfeaa04275bf0fda96a8fd01ca8b9e4f0cad9af56980a32e
5
5
  SHA512:
6
- metadata.gz: b13e6b800070c71ce5ef28ea908cae648cb32f222f90421b3d31b6ed17c0f699016bfe71e071943fdb5d5cb71003890c5c079cd452000b5f3d897df29acb5a92
7
- data.tar.gz: 0dbb08fe19f823a4415c14b7f3850731a3ed64d50e159a439282438325e1c1cf34034f4588e26ebd583b349a05dcfbb4967ed308b0ec9159be03260c03a0b70a
6
+ metadata.gz: 3f7a48a98d34b3f12e45256268186c36199eabaa29ea771a23201d4423d8caf73d85043140c86ded5ad3f33120f5d057842aefe7ef4841710b3c0ccde92e3f04
7
+ data.tar.gz: 785620faeb604237353ab31793a7dac6c645fad9c9897a43d5cfdb5b50f5bb291342a4f38d94c227deb055a735f4c2900c6f712db9f45372787c0d57ef691701
@@ -41,7 +41,7 @@ module Bridgetown
41
41
  document_data = document.data[index_key]
42
42
  document_data = document_data.split(%r!;|,!) if document_data.is_a?(String)
43
43
 
44
- document_data.each do |key|
44
+ Array(document_data).each do |key|
45
45
  key = key.to_s.downcase.strip
46
46
  # If the key is a delimetered list of values
47
47
  # (meaning the user didn't use an array but a string with commas)
@@ -66,6 +66,11 @@ module Bridgetown
66
66
 
67
67
  next unless template_config["enabled"]
68
68
 
69
+ if template.site.config.available_locales.size > 1 && !template_config["locale"]
70
+ template_config["locale"] =
71
+ template.data["locale"].to_s
72
+ end
73
+
69
74
  @logging_lambda.call "found page: #{template.path}", "debug" unless @debug
70
75
 
71
76
  # Request all documents in all collections that the user has requested
@@ -366,18 +371,7 @@ module Bridgetown
366
371
  index_page_ext
367
372
  )
368
373
 
369
- # Create the url for the new page, make sure we prepend any permalinks
370
- # that are defined in the template page before
371
- if newpage.paginator.page_path.end_with? "/"
372
- newpage.set_url(File.join(newpage.paginator.page_path, index_page_with_ext))
373
- elsif newpage.paginator.page_path.end_with? index_page_ext.to_s
374
- # Support for direct .html files
375
- newpage.set_url(newpage.paginator.page_path)
376
- else
377
- # Support for extensionless permalinks
378
- newpage.set_url(newpage.paginator.page_path + index_page_ext.to_s)
379
- end
380
-
374
+ newpage.set_url(newpage.paginator.page_path)
381
375
  newpage.data["permalink"] = newpage.paginator.page_path if template.data["permalink"]
382
376
 
383
377
  # Transfer the title across to the new page
@@ -34,10 +34,19 @@ module Bridgetown
34
34
  # rubocop:disable Naming/AccessorMethodName
35
35
  def set_url(url_value)
36
36
  @path = url_value.delete_prefix "/"
37
- @dir = File.dirname(@path)
37
+ @dir = @path.ends_with?("/") ? @path : File.dirname(@path)
38
38
  @url = url_value
39
39
  end
40
40
  # rubocop:enable Naming/AccessorMethodName
41
+
42
+ def destination(dest)
43
+ path = site.in_dest_dir(
44
+ dest, URL.unescape_path(url).delete_prefix(site.base_path(strip_slash_only: true))
45
+ )
46
+ path = File.join(path, "index") if url.end_with?("/")
47
+ path << output_ext unless path.end_with? output_ext
48
+ path
49
+ end
41
50
  end
42
51
  end
43
52
  end
@@ -42,8 +42,8 @@ module Bridgetown
42
42
  # Ensure that the current page has correct extensions if needed
43
43
  this_page_url = Utils.ensure_full_path(
44
44
  @page == 1 ? first_index_page_url : paginated_page_url,
45
- !default_indexpage || default_indexpage.empty? ? "index" : default_indexpage,
46
- !default_ext || default_ext.empty? ? ".html" : default_ext
45
+ default_indexpage || "",
46
+ default_ext || ""
47
47
  )
48
48
 
49
49
  # To support customizable pagination pages we attempt to explicitly
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: 1.0.0.beta2
4
+ version: 1.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-26 00:00:00.000000000 Z
11
+ date: 2022-06-02 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: 1.0.0.beta2
19
+ version: 1.1.0.beta1
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: 1.0.0.beta2
26
+ version: 1.1.0.beta1
27
27
  description:
28
28
  email: maintainers@bridgetownrb.com
29
29
  executables: []