jekyll-auto-authors 1.0.4 → 1.0.5

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: 65d2e6ed40ee995dffb47243d438b9eac97de5030f211828ff69510f9eaac031
4
- data.tar.gz: 7390218b4f544518c1e4e7533cb86821c6b5a82189b46f12a02c00dd7d2fd192
3
+ metadata.gz: b9cb82ffc53b7c2d6688fe7d1839b4eb7512d491e5cf481fbc796296d0f92215
4
+ data.tar.gz: d33d994940b4d5cd8e2576033290c916b5d0f5432b4af5196d7964a6126f1fc8
5
5
  SHA512:
6
- metadata.gz: 6cff403611021beefa94d0d8fdd8e6d10e0b72087154868ddb215df7faaa1c619fe2b9c95928aae325957f203d12a6efc7c281af412fd9f86a81ed7e636b1c61
7
- data.tar.gz: 3f0bf9e838648cb663225fd4731e36afb89324771bb2e988bd84bb7eed9d1df02d853dd4d52a6e7dbe28e7a27d2caae1fc26b045c0ef7266343828b3d44c2334
6
+ metadata.gz: 6dc866ee5fc6739fbac4230ce6f2dc71ee4249df63581720627723ef350e968bf867673605dd7c99067827d2438cc92659fd214b60d8c5d4805319d878883706
7
+ data.tar.gz: 7386a360a27c535d4743a138cb03fa1fe8849927511f05f8f12f0b76b4f3a28807935ecc7d3ea0614ae525d40f434f5964779b07888477535d5fd64c9fdf0a8c
@@ -12,14 +12,17 @@ module Jekyll
12
12
  set_autopage_data_lambda = lambda do | in_config |
13
13
  in_config["author"] = author
14
14
 
15
- if autopage_config["data"].nil?
16
- return
17
- end
15
+ return if autopage_config["data"].nil?
16
+
17
+ # if the data file containing authors info is not nil, transfer current author's data
18
+ # to the paginator object so that it can be used in the pagination template
19
+ author_data = YAML::load(File.read(autopage_config["data"])) || {}
18
20
 
19
- # if a data file containing authors is not nil, transfer it to paginator object
20
- # so that it can be used in the pagination template
21
- author_data = YAML::load(File.read(autopage_config["data"]))
22
- in_config["author_data"] = author_data[author_name]
21
+ if author_data.key?(author_name)
22
+ in_config["author_data"] = author_data[author_name]
23
+ else
24
+ Jekyll.logger.warn "Author Pages:", "Data for author '#{author_name}' not found. Page will be generated without data."
25
+ end
23
26
  end
24
27
 
25
28
  # Lambdas to return formatted permalink and title.
@@ -5,7 +5,7 @@ module Jekyll
5
5
  DEFAULT = {
6
6
  "enabled" => false, # Enable or disable the plugin.
7
7
 
8
- "data" => "_data/authors.yml", # The data file inside _data/ folder that contains author information.
8
+ "data" => nil, # The path to file that contains authors information. example: "_data/authors.yml"
9
9
  "layouts" => ["authors.html"], # The layout file inside _layouts/ folder to use for the author pages.
10
10
 
11
11
  "exclude" => [], # The list of authors to **force** skip processing an autopage for.
@@ -34,15 +34,6 @@ module Jekyll
34
34
  createauthorpage_lambda = lambda do | autopage_author_config, pagination_config, layout_name, author, author_original_name |
35
35
  # Force skip excluded authors from autopage generation
36
36
  return if autopage_author_config["exclude"].include?(author)
37
-
38
- if !autopage_author_config["data"].nil?
39
- author_data = YAML::load(File.read(autopage_author_config["data"]))[author_original_name]
40
-
41
- if author_data.nil?
42
- Jekyll.logger.warn "Author Pages:", "Author data for '#{author_original_name}' not found. Page will be generated without data."
43
- end
44
- end
45
-
46
37
  site.pages << AuthorAutoPage.new(site, site.dest, autopage_author_config, pagination_config, layout_name, author, author_original_name)
47
38
  end
48
39
 
@@ -74,11 +65,11 @@ module Jekyll
74
65
  if !authors_config["data"].nil?
75
66
  # if a data file containing authors is not nil, then iterate through the specified
76
67
  # authors to build author pages for them, even if they don't have posts yet.
77
- author_data = YAML::load(File.read(authors_config["data"]))
68
+ author_data = YAML::load(File.read(authors_config["data"])) || {}
78
69
 
79
70
  author_data.each do | author, data |
80
71
  # The exclude attribute ignores authors from autopage generation unless they have a post assigned.
81
- if !finished_pages.include?(author) and !data["exclude"]
72
+ if !finished_pages.include?(author) && !(data || {}).fetch("exclude", false)
82
73
  # create pages for pending authors with specified layouts
83
74
  authors_config['layouts'].each do | layout_name |
84
75
  createauthorpage_lambda.call(authors_config, pagination_config, layout_name, author, author)
@@ -87,6 +78,8 @@ module Jekyll
87
78
  finished_pages << author
88
79
  end
89
80
  end
81
+ else
82
+ Jekyll.logger.warn "Author Pages:", "Authors data file not specified. Pages will be generated without data."
90
83
  end
91
84
 
92
85
  # Now auto pages for authors have been created, we can generate the pagination logic.
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AutoAuthors
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-auto-authors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gourav Khunger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-11 00:00:00.000000000 Z
11
+ date: 2025-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.4.13
91
+ rubygems_version: 3.4.17
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Seamless multiple authors support for jekyll powered publications