jekyll-ical-tag 1.3.3 → 1.5

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: d7d1dce12392f01bb0a4d092684ffcec0dd51dd099a5c4d84634c2a4f5873785
4
- data.tar.gz: 3bea7aac7663335f7df8928a10cff12bdc45a0ed0d59dc98530e18f35ca302ce
3
+ metadata.gz: bd9aae8578b4e747ceb38bae139ef9a7b900a9ab15c4b7ddd8b86c2bc4e1d63d
4
+ data.tar.gz: b9b8f3f424cd86baee95a8ecff82ec7e5a9423f2118e4a70d949d8689f8a10c9
5
5
  SHA512:
6
- metadata.gz: 422e9632764d6c14a00aabab84592fde181f66782870de1d9eeaee7bdfa2c7531cf262c00ec16d25c13951490a8a937edfc746cd55387870169aebb3687cc58c
7
- data.tar.gz: 6cc3cb90d9c76cfb50768522dc6c0205fdeab97baf621fe9be7983185724cbd1c79773f5c5027fb5fe527995706b25b186d97327b08399fb45a5caa3ae26fd8f
6
+ metadata.gz: 34dc052e75be4eac928d6b4d0e6eaa4ab2bb80cae1d12770cad69079fbb37815c668df61584a1b735ccb71c6adae9b1d7220e6b45504aa81b6e476d51c414a7b
7
+ data.tar.gz: 6071a16177cdbcdb4e508d3e8974b25af01cc59f8f4511ea122734ca18b2d00d5aa83e695abcfe6912f79d52dd97f97ff350ec46936db078972c55aee16c4639
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby system
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gem 'jekyll', require: false
4
4
 
5
5
  gem 'api_cache'
6
- gem 'icalendar'
6
+ gem 'icalendar', "~> 2.10.1"
7
7
  gem 'activesupport'
8
8
 
9
9
  group :development, :test do
data/Gemfile.lock CHANGED
@@ -1,93 +1,97 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (5.2.4.3)
4
+ activesupport (7.0.5.1)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (>= 0.7, < 2)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- addressable (2.7.0)
10
- public_suffix (>= 2.0.2, < 5.0)
6
+ i18n (>= 1.6, < 2)
7
+ minitest (>= 5.1)
8
+ tzinfo (~> 2.0)
9
+ addressable (2.8.4)
10
+ public_suffix (>= 2.0.2, < 6.0)
11
11
  api_cache (0.3.0)
12
12
  colorator (1.1.0)
13
- concurrent-ruby (1.1.6)
14
- diff-lcs (1.3)
15
- em-websocket (0.5.1)
13
+ concurrent-ruby (1.2.2)
14
+ diff-lcs (1.5.0)
15
+ em-websocket (0.5.3)
16
16
  eventmachine (>= 0.12.9)
17
- http_parser.rb (~> 0.6.0)
17
+ http_parser.rb (~> 0)
18
18
  eventmachine (1.2.7)
19
- ffi (1.12.2)
19
+ ffi (1.15.5)
20
20
  forwardable-extended (2.6.0)
21
- http_parser.rb (0.6.0)
22
- i18n (1.8.2)
21
+ google-protobuf (3.23.3)
22
+ http_parser.rb (0.8.0)
23
+ i18n (1.14.1)
23
24
  concurrent-ruby (~> 1.0)
24
- icalendar (2.5.0)
25
+ icalendar (2.10.1)
25
26
  ice_cube (~> 0.16)
26
- ice_cube (0.16.3)
27
- jekyll (4.0.0)
27
+ ice_cube (0.16.4)
28
+ jekyll (4.3.2)
28
29
  addressable (~> 2.4)
29
30
  colorator (~> 1.0)
30
31
  em-websocket (~> 0.5)
31
- i18n (>= 0.9.5, < 2)
32
- jekyll-sass-converter (~> 2.0)
32
+ i18n (~> 1.0)
33
+ jekyll-sass-converter (>= 2.0, < 4.0)
33
34
  jekyll-watch (~> 2.0)
34
- kramdown (~> 2.1)
35
+ kramdown (~> 2.3, >= 2.3.1)
35
36
  kramdown-parser-gfm (~> 1.0)
36
37
  liquid (~> 4.0)
37
- mercenary (~> 0.3.3)
38
+ mercenary (>= 0.3.6, < 0.5)
38
39
  pathutil (~> 0.9)
39
- rouge (~> 3.0)
40
+ rouge (>= 3.0, < 5.0)
40
41
  safe_yaml (~> 1.0)
41
- terminal-table (~> 1.8)
42
- jekyll-sass-converter (2.1.0)
43
- sassc (> 2.0.1, < 3.0)
42
+ terminal-table (>= 1.8, < 4.0)
43
+ webrick (~> 1.7)
44
+ jekyll-sass-converter (3.0.0)
45
+ sass-embedded (~> 1.54)
44
46
  jekyll-watch (2.2.1)
45
47
  listen (~> 3.0)
46
- kramdown (2.3.1)
48
+ kramdown (2.4.0)
47
49
  rexml
48
50
  kramdown-parser-gfm (1.1.0)
49
51
  kramdown (~> 2.0)
50
- liquid (4.0.3)
51
- listen (3.2.1)
52
+ liquid (4.0.4)
53
+ listen (3.8.0)
52
54
  rb-fsevent (~> 0.10, >= 0.10.3)
53
55
  rb-inotify (~> 0.9, >= 0.9.10)
54
- mercenary (0.3.6)
55
- mini_portile2 (2.5.0)
56
- minitest (5.14.1)
57
- nokogiri (1.11.0)
58
- mini_portile2 (~> 2.5.0)
56
+ mercenary (0.4.0)
57
+ mini_portile2 (2.8.2)
58
+ minitest (5.18.1)
59
+ nokogiri (1.15.2)
60
+ mini_portile2 (~> 2.8.2)
59
61
  racc (~> 1.4)
60
62
  pathutil (0.16.2)
61
63
  forwardable-extended (~> 2.6)
62
- public_suffix (4.0.3)
63
- racc (1.5.2)
64
- rb-fsevent (0.10.3)
64
+ public_suffix (5.0.1)
65
+ racc (1.7.1)
66
+ rake (13.0.6)
67
+ rb-fsevent (0.11.2)
65
68
  rb-inotify (0.10.1)
66
69
  ffi (~> 1.0)
67
- rexml (3.2.4)
68
- rouge (3.17.0)
69
- rspec (3.7.0)
70
- rspec-core (~> 3.7.0)
71
- rspec-expectations (~> 3.7.0)
72
- rspec-mocks (~> 3.7.0)
73
- rspec-core (3.7.0)
74
- rspec-support (~> 3.7.0)
75
- rspec-expectations (3.7.0)
70
+ rexml (3.2.5)
71
+ rouge (4.1.2)
72
+ rspec (3.12.0)
73
+ rspec-core (~> 3.12.0)
74
+ rspec-expectations (~> 3.12.0)
75
+ rspec-mocks (~> 3.12.0)
76
+ rspec-core (3.12.2)
77
+ rspec-support (~> 3.12.0)
78
+ rspec-expectations (3.12.3)
76
79
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.7.0)
78
- rspec-mocks (3.7.0)
80
+ rspec-support (~> 3.12.0)
81
+ rspec-mocks (3.12.5)
79
82
  diff-lcs (>= 1.2.0, < 2.0)
80
- rspec-support (~> 3.7.0)
81
- rspec-support (3.7.0)
83
+ rspec-support (~> 3.12.0)
84
+ rspec-support (3.12.1)
82
85
  safe_yaml (1.0.5)
83
- sassc (2.2.1)
84
- ffi (~> 1.9)
85
- terminal-table (1.8.0)
86
- unicode-display_width (~> 1.1, >= 1.1.1)
87
- thread_safe (0.3.6)
88
- tzinfo (1.2.7)
89
- thread_safe (~> 0.1)
90
- unicode-display_width (1.7.0)
86
+ sass-embedded (1.63.6)
87
+ google-protobuf (~> 3.23)
88
+ rake (>= 13.0.0)
89
+ terminal-table (3.0.2)
90
+ unicode-display_width (>= 1.1.1, < 3)
91
+ tzinfo (2.0.6)
92
+ concurrent-ruby (~> 1.0)
93
+ unicode-display_width (2.4.2)
94
+ webrick (1.8.1)
91
95
 
92
96
  PLATFORMS
93
97
  ruby
@@ -95,7 +99,7 @@ PLATFORMS
95
99
  DEPENDENCIES
96
100
  activesupport
97
101
  api_cache
98
- icalendar
102
+ icalendar (~> 2.10.1)
99
103
  jekyll
100
104
  nokogiri
101
105
  rspec
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "jekyll", "> 3"
34
34
  spec.add_dependency "api_cache"
35
35
  spec.add_dependency "activesupport"
36
- spec.add_dependency "icalendar"
36
+ spec.add_dependency "icalendar", "~> 2.10.1"
37
37
 
38
38
  spec.add_development_dependency "bundler", "~> 1.15"
39
39
  spec.add_development_dependency "rspec", "~> 3.5"
@@ -80,7 +80,7 @@ module Jekyll
80
80
  props.transform_values! do |value|
81
81
  new_value =
82
82
  case value
83
- when Array, Icalendar::Values::Array
83
+ when Array, Icalendar::Values::Helpers::Array
84
84
  value.join("\n").force_encoding("UTF-8")
85
85
  when String, Icalendar::Values::Text
86
86
  value.force_encoding("UTF-8")
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  class IcalTag < Liquid::Block
5
- VERSION = "1.3.3"
5
+ VERSION = "1.5"
6
6
  end
7
7
  end
@@ -22,10 +22,7 @@ module Jekyll
22
22
  scan_attributes!
23
23
  set_limit!
24
24
  set_reverse!
25
- set_url!
26
25
  set_only!
27
- set_before_date!
28
- set_after_date!
29
26
  end
30
27
 
31
28
  def render(context)
@@ -34,11 +31,13 @@ module Jekyll
34
31
  result = []
35
32
 
36
33
  context.stack do
37
- url = get_dereferenced_url(context) || @url
34
+ url = dereferenced_liquid_val(context, "url")
35
+ before_date = before_date_from(context)
36
+ after_date = after_date_from(context)
38
37
 
39
38
  calendar_feed_coordinator = CalendarFeedCoordinator.new(
40
39
  url: url, only: @only, reverse: @reverse,
41
- before_date: @before_date, after_date: @after_date,
40
+ before_date: before_date, after_date: after_date,
42
41
  limit: @limit
43
42
  )
44
43
  events = calendar_feed_coordinator.events
@@ -91,10 +90,35 @@ module Jekyll
91
90
 
92
91
  private
93
92
 
94
- def get_dereferenced_url(context)
95
- return unless context.key?(@url)
93
+ def after_date_from(context)
94
+ safely_cast_to_time(
95
+ dereferenced_liquid_val(context, "after_date")
96
+ )
97
+ end
98
+
99
+ def before_date_from(context)
100
+ safely_cast_to_time(
101
+ dereferenced_liquid_val(context, "before_date")
102
+ )
103
+ end
104
+
105
+ def safely_cast_to_time(val)
106
+ case val
107
+ when String
108
+ Time.parse(val)
109
+ when Date, DateTime, Time
110
+ val
111
+ when NilClass
112
+ # Do nothing
113
+ else
114
+ raise "Cannot cast to Time: #{val}"
115
+ end
116
+ end
96
117
 
97
- context[@url]
118
+ def dereferenced_liquid_val(context, variable_name)
119
+ raw_value = @attributes[variable_name]
120
+
121
+ context.key?(raw_value) ? context[raw_value] : raw_value
98
122
  end
99
123
 
100
124
  def scan_attributes!
@@ -112,10 +136,6 @@ module Jekyll
112
136
  @reverse = @attributes["reverse"] == "true"
113
137
  end
114
138
 
115
- def set_url!
116
- @url = @attributes["url"]
117
- end
118
-
119
139
  def set_only!
120
140
  only_future = @attributes["only_future"] == "true"
121
141
  only_past = @attributes["only_past"] == "true"
@@ -131,24 +151,6 @@ module Jekyll
131
151
  :all
132
152
  end
133
153
  end
134
-
135
- def set_before_date!
136
- @before_date =
137
- begin
138
- Time.parse(@attributes["before_date"])
139
- rescue
140
- nil
141
- end
142
- end
143
-
144
- def set_after_date!
145
- @after_date =
146
- begin
147
- Time.parse(@attributes["after_date"])
148
- rescue
149
- nil
150
- end
151
- end
152
154
  end
153
155
  end
154
156
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-ical-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: '1.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricky Chilcott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-03 00:00:00.000000000 Z
11
+ date: 2024-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: icalendar
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 2.10.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 2.10.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
105
  - ".rspec"
106
+ - ".tool-versions"
106
107
  - Gemfile
107
108
  - Gemfile.lock
108
109
  - README.md
@@ -136,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  requirements: []
139
- rubygems_version: 3.1.2
140
+ rubygems_version: 3.5.3
140
141
  signing_key:
141
142
  specification_version: 4
142
143
  summary: A Jekyll plugin to pull ICS feed and provide a for-like loop of calendar