jekyll-ical-tag 1.6.0 → 2.0.0

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: 1b71de33f80f9e2ff9554027bea500fa7e66d68468aaed22e539e4551b5e2132
4
- data.tar.gz: 130b7534016609598f51c37216a95c36993c78e0e75569107f5eb521d12a4e31
3
+ metadata.gz: 2b8325da1bc683a9e35b4834dc90ad16d93b56adde7b74d710a4deed8e0a8531
4
+ data.tar.gz: 1ad7089ce95916d6bf5f198a015d6570b331ba3b1e33a249a5c557a3070a4bd3
5
5
  SHA512:
6
- metadata.gz: 70b795e541f7c3b15f588d606e0f5aaf0734a9e0fae90a6980b2fdafbd871d2e97a25e772aec02faa16441ff828acc6fb3d9afa36e6d66cc2307c9868504ec3f
7
- data.tar.gz: eaaf3787045379728460e53d317becabf502cc9382e41cb60ff4a965ad264a5292acf25f2b7d325bb53eda68ccca1bb830322438f66b6ed9fdd2af582ab046fa
6
+ metadata.gz: 2059b736463ca3e408a4eb08620185326f3b3176adaeff6ca9a8215f27f08ace7dcefaf02dd50e49c15295905cb5ce728c5e97e40ae18f02a13ef2998466a88f
7
+ data.tar.gz: 90de38da13b58df98717ec7285067a4ae8f776caca93898c1db5b46d7b41809227d1e2ab155253493db830f418ddc3166c4022488bd2b973a3847482329a5d81
data/README.md CHANGED
@@ -33,6 +33,21 @@ plugins:
33
33
  {% endical %}
34
34
  ```
35
35
 
36
+ ### Empty state
37
+
38
+ Use the `{% empty %}` tag to display fallback content when the calendar has no events:
39
+
40
+ ```html
41
+ {% ical url: https://space.floern.com/launch.ics only_future: true %}
42
+ <div class="event">
43
+ <h3>{{ event.summary }}</h3>
44
+ <p>{{ event.dtstart | date: "%B %d, %Y" }}</p>
45
+ </div>
46
+ {% empty %}
47
+ <p>No upcoming events scheduled.</p>
48
+ {% endical %}
49
+ ```
50
+
36
51
  ## Options
37
52
 
38
53
  - `reverse` - Defaults to 'false', ordering events by start_time (or reverse start_time).
@@ -25,17 +25,17 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.required_ruby_version = ">= 2.3.0"
27
27
 
28
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ spec.files = `git ls-files -z -- lib README.md jekyll-ical-tag.gemspec`.split("\x0")
29
29
  spec.bindir = "exe"
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  spec.add_dependency "jekyll", "> 3"
34
34
  spec.add_dependency "api_cache"
35
- spec.add_dependency "activesupport", "~> 7.1"
36
- spec.add_dependency "icalendar", "~> 2.10.1"
35
+ spec.add_dependency "activesupport", ">= 8.0.5.2"
36
+ spec.add_dependency "icalendar", "~> 2.12", ">= 2.12.2"
37
37
  spec.add_dependency "icalendar-recurrence"
38
38
 
39
- spec.add_development_dependency "bundler", "~> 1.15"
39
+ spec.add_development_dependency "bundler", "~> 2.2"
40
40
  spec.add_development_dependency "rspec", "~> 3.5"
41
41
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  class IcalTag < Liquid::Block
5
- VERSION = "1.6.0"
5
+ VERSION = "2.0.0"
6
6
  end
7
7
  end
@@ -17,6 +17,8 @@ module Jekyll
17
17
  super
18
18
  @markup = markup
19
19
  @attributes = {}
20
+ @main_block = Liquid::BlockBody.new
21
+ @empty_block = nil
20
22
 
21
23
  scan_attributes!
22
24
  set_limit!
@@ -24,6 +26,20 @@ module Jekyll
24
26
  set_only!
25
27
  end
26
28
 
29
+ def parse(tokens)
30
+ return unless parse_body(@main_block, tokens)
31
+ parse_body(@empty_block, tokens)
32
+ end
33
+
34
+ def nodelist
35
+ @empty_block ? [@main_block, @empty_block] : [@main_block]
36
+ end
37
+
38
+ def unknown_tag(tag, markup, tokens)
39
+ return super unless tag == "empty"
40
+ @empty_block = Liquid::BlockBody.new
41
+ end
42
+
27
43
  def render(context)
28
44
  self.context = context
29
45
  context.registers[:ical] ||= Hash.new(0)
@@ -48,47 +64,46 @@ module Jekyll
48
64
  recurring_end_date: @recurring_end_date
49
65
  )
50
66
  events = calendar_feed_coordinator.events
51
- event_count = events.length
52
-
53
- events.each_with_index do |event, index|
54
- # Init
55
- context["event"] = {}
56
-
57
- # Jekyll helper variables
58
- context["event"]["index"] = index
59
-
60
- # RFC 5545 conformant and custom properties.
61
- context["event"].merge!(event.all_properties)
62
-
63
- # Supported but non-standard attributes.
64
- context["event"]["attendees"] = event.attendees
65
- context["event"]["simple_html_description"] = event.simple_html_description
66
-
67
- # Overridden values
68
- context["event"]["url"] ||= event.description_urls.first
69
-
70
- # Deprecated attribute names.
71
- context["event"]["end_time"] = context["event"]["dtend"]
72
- context["event"]["start_time"] = context["event"]["dtstart"]
73
-
74
- context["forloop"] = {
75
- "name" => "ical",
76
- "length" => event_count,
77
- "index" => index + 1,
78
- "index0" => index,
79
- "rindex" => event_count - index,
80
- "rindex0" => event_count - index - 1,
81
- "first" => (index == 0),
82
- "last" => (index == event_count - 1)
83
- }
84
-
85
- result << nodelist.map do |n|
86
- if n.respond_to? :render
87
- n.render(context)
88
- else
89
- n
90
- end
91
- end.join
67
+
68
+ if events.empty?
69
+ result << @empty_block.render(context) if @empty_block
70
+ else
71
+ event_count = events.length
72
+
73
+ events.each_with_index do |event, index|
74
+ # Init
75
+ context["event"] = {}
76
+
77
+ # Jekyll helper variables
78
+ context["event"]["index"] = index
79
+
80
+ # RFC 5545 conformant and custom properties.
81
+ context["event"].merge!(event.all_properties)
82
+
83
+ # Supported but non-standard attributes.
84
+ context["event"]["attendees"] = event.attendees
85
+ context["event"]["simple_html_description"] = event.simple_html_description
86
+
87
+ # Overridden values
88
+ context["event"]["url"] ||= event.description_urls.first
89
+
90
+ # Deprecated attribute names.
91
+ context["event"]["end_time"] = context["event"]["dtend"]
92
+ context["event"]["start_time"] = context["event"]["dtstart"]
93
+
94
+ context["forloop"] = {
95
+ "name" => "ical",
96
+ "length" => event_count,
97
+ "index" => index + 1,
98
+ "index0" => index,
99
+ "rindex" => event_count - index,
100
+ "rindex0" => event_count - index - 1,
101
+ "first" => (index == 0),
102
+ "last" => (index == event_count - 1)
103
+ }
104
+
105
+ result << @main_block.render(context)
106
+ end
92
107
  end
93
108
  end
94
109
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-ical-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricky Chilcott
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-07-20 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: jekyll
@@ -42,30 +41,36 @@ dependencies:
42
41
  name: activesupport
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - "~>"
44
+ - - ">="
46
45
  - !ruby/object:Gem::Version
47
- version: '7.1'
46
+ version: 8.0.5.2
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
- - - "~>"
51
+ - - ">="
53
52
  - !ruby/object:Gem::Version
54
- version: '7.1'
53
+ version: 8.0.5.2
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: icalendar
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: 2.10.1
60
+ version: '2.12'
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 2.12.2
62
64
  type: :runtime
63
65
  prerelease: false
64
66
  version_requirements: !ruby/object:Gem::Requirement
65
67
  requirements:
66
68
  - - "~>"
67
69
  - !ruby/object:Gem::Version
68
- version: 2.10.1
70
+ version: '2.12'
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 2.12.2
69
74
  - !ruby/object:Gem::Dependency
70
75
  name: icalendar-recurrence
71
76
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +91,14 @@ dependencies:
86
91
  requirements:
87
92
  - - "~>"
88
93
  - !ruby/object:Gem::Version
89
- version: '1.15'
94
+ version: '2.2'
90
95
  type: :development
91
96
  prerelease: false
92
97
  version_requirements: !ruby/object:Gem::Requirement
93
98
  requirements:
94
99
  - - "~>"
95
100
  - !ruby/object:Gem::Version
96
- version: '1.15'
101
+ version: '2.2'
97
102
  - !ruby/object:Gem::Dependency
98
103
  name: rspec
99
104
  requirement: !ruby/object:Gem::Requirement
@@ -108,23 +113,13 @@ dependencies:
108
113
  - - "~>"
109
114
  - !ruby/object:Gem::Version
110
115
  version: '3.5'
111
- description:
112
116
  email:
113
117
  - ricky@rakefire.io
114
118
  executables: []
115
119
  extensions: []
116
120
  extra_rdoc_files: []
117
121
  files:
118
- - ".github/workflows/build.yml"
119
- - ".gitignore"
120
- - ".rspec"
121
- - ".tool-versions"
122
- - Gemfile
123
- - Gemfile.lock
124
122
  - README.md
125
- - bin/build-and-publish-gem
126
- - bin/rspec
127
- - bin/standardrb
128
123
  - jekyll-ical-tag.gemspec
129
124
  - lib/jekyll-ical-tag.rb
130
125
  - lib/jekyll-ical-tag/calendar_feed_coordinator.rb
@@ -138,7 +133,6 @@ licenses:
138
133
  - MIT
139
134
  metadata:
140
135
  allowed_push_host: https://rubygems.org
141
- post_install_message:
142
136
  rdoc_options: []
143
137
  require_paths:
144
138
  - lib
@@ -153,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
147
  - !ruby/object:Gem::Version
154
148
  version: '0'
155
149
  requirements: []
156
- rubygems_version: 3.5.9
157
- signing_key:
150
+ rubygems_version: 3.6.9
158
151
  specification_version: 4
159
152
  summary: A Jekyll plugin to pull ICS feed and provide a for-like loop of calendar
160
153
  events
@@ -1,39 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - main
8
-
9
- jobs:
10
- lint:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v4
15
-
16
- - uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: 3.3
19
- bundler-cache: true
20
-
21
- - run: bin/standardrb
22
-
23
- test:
24
- runs-on: ubuntu-latest
25
-
26
- strategy:
27
- fail-fast: false
28
- matrix:
29
- ruby: [3.0, 3.1, 3.2, 3.3]
30
-
31
- steps:
32
- - uses: actions/checkout@v4
33
-
34
- - uses: ruby/setup-ruby@v1
35
- with:
36
- ruby-version: ${{ matrix.ruby }}
37
- bundler-cache: true
38
-
39
- - run: bundle exec rspec
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- .DS_Store
2
- .bundle
3
- *.gem
4
-
5
- spec/examples.txt
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec_helper
data/.tool-versions DELETED
@@ -1 +0,0 @@
1
- ruby system
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "jekyll", require: false
4
-
5
- gem "activesupport"
6
- gem "api_cache"
7
- gem "icalendar", "~> 2.10.1"
8
- gem "icalendar-recurrence"
9
-
10
- group :development, :test do
11
- gem "rspec"
12
- gem "nokogiri"
13
- gem "standard"
14
- end
data/Gemfile.lock DELETED
@@ -1,165 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- activesupport (7.1.3.2)
5
- base64
6
- bigdecimal
7
- concurrent-ruby (~> 1.0, >= 1.0.2)
8
- connection_pool (>= 2.2.5)
9
- drb
10
- i18n (>= 1.6, < 2)
11
- minitest (>= 5.1)
12
- mutex_m
13
- tzinfo (~> 2.0)
14
- addressable (2.8.4)
15
- public_suffix (>= 2.0.2, < 6.0)
16
- api_cache (0.3.0)
17
- ast (2.4.2)
18
- base64 (0.2.0)
19
- bigdecimal (3.1.6)
20
- colorator (1.1.0)
21
- concurrent-ruby (1.2.3)
22
- connection_pool (2.4.1)
23
- diff-lcs (1.5.0)
24
- drb (2.2.0)
25
- ruby2_keywords
26
- em-websocket (0.5.3)
27
- eventmachine (>= 0.12.9)
28
- http_parser.rb (~> 0)
29
- eventmachine (1.2.7)
30
- ffi (1.15.5)
31
- forwardable-extended (2.6.0)
32
- google-protobuf (3.23.3)
33
- http_parser.rb (0.8.0)
34
- i18n (1.14.1)
35
- concurrent-ruby (~> 1.0)
36
- icalendar (2.10.1)
37
- ice_cube (~> 0.16)
38
- icalendar-recurrence (1.2.0)
39
- icalendar (~> 2.0)
40
- ice_cube (~> 0.16)
41
- tzinfo (~> 2.0)
42
- ice_cube (0.16.4)
43
- jekyll (4.3.2)
44
- addressable (~> 2.4)
45
- colorator (~> 1.0)
46
- em-websocket (~> 0.5)
47
- i18n (~> 1.0)
48
- jekyll-sass-converter (>= 2.0, < 4.0)
49
- jekyll-watch (~> 2.0)
50
- kramdown (~> 2.3, >= 2.3.1)
51
- kramdown-parser-gfm (~> 1.0)
52
- liquid (~> 4.0)
53
- mercenary (>= 0.3.6, < 0.5)
54
- pathutil (~> 0.9)
55
- rouge (>= 3.0, < 5.0)
56
- safe_yaml (~> 1.0)
57
- terminal-table (>= 1.8, < 4.0)
58
- webrick (~> 1.7)
59
- jekyll-sass-converter (3.0.0)
60
- sass-embedded (~> 1.54)
61
- jekyll-watch (2.2.1)
62
- listen (~> 3.0)
63
- json (2.7.2)
64
- kramdown (2.4.0)
65
- rexml
66
- kramdown-parser-gfm (1.1.0)
67
- kramdown (~> 2.0)
68
- language_server-protocol (3.17.0.3)
69
- lint_roller (1.1.0)
70
- liquid (4.0.4)
71
- listen (3.8.0)
72
- rb-fsevent (~> 0.10, >= 0.10.3)
73
- rb-inotify (~> 0.9, >= 0.9.10)
74
- mercenary (0.4.0)
75
- mini_portile2 (2.8.2)
76
- minitest (5.22.2)
77
- mutex_m (0.2.0)
78
- nokogiri (1.15.2)
79
- mini_portile2 (~> 2.8.2)
80
- racc (~> 1.4)
81
- parallel (1.25.1)
82
- parser (3.3.4.0)
83
- ast (~> 2.4.1)
84
- racc
85
- pathutil (0.16.2)
86
- forwardable-extended (~> 2.6)
87
- public_suffix (5.0.1)
88
- racc (1.7.1)
89
- rainbow (3.1.1)
90
- rake (13.0.6)
91
- rb-fsevent (0.11.2)
92
- rb-inotify (0.10.1)
93
- ffi (~> 1.0)
94
- regexp_parser (2.9.2)
95
- rexml (3.2.5)
96
- rouge (4.1.2)
97
- rspec (3.12.0)
98
- rspec-core (~> 3.12.0)
99
- rspec-expectations (~> 3.12.0)
100
- rspec-mocks (~> 3.12.0)
101
- rspec-core (3.12.2)
102
- rspec-support (~> 3.12.0)
103
- rspec-expectations (3.12.3)
104
- diff-lcs (>= 1.2.0, < 2.0)
105
- rspec-support (~> 3.12.0)
106
- rspec-mocks (3.12.5)
107
- diff-lcs (>= 1.2.0, < 2.0)
108
- rspec-support (~> 3.12.0)
109
- rspec-support (3.12.1)
110
- rubocop (1.64.1)
111
- json (~> 2.3)
112
- language_server-protocol (>= 3.17.0)
113
- parallel (~> 1.10)
114
- parser (>= 3.3.0.2)
115
- rainbow (>= 2.2.2, < 4.0)
116
- regexp_parser (>= 1.8, < 3.0)
117
- rexml (>= 3.2.5, < 4.0)
118
- rubocop-ast (>= 1.31.1, < 2.0)
119
- ruby-progressbar (~> 1.7)
120
- unicode-display_width (>= 2.4.0, < 3.0)
121
- rubocop-ast (1.31.3)
122
- parser (>= 3.3.1.0)
123
- rubocop-performance (1.21.1)
124
- rubocop (>= 1.48.1, < 2.0)
125
- rubocop-ast (>= 1.31.1, < 2.0)
126
- ruby-progressbar (1.13.0)
127
- ruby2_keywords (0.0.5)
128
- safe_yaml (1.0.5)
129
- sass-embedded (1.63.6)
130
- google-protobuf (~> 3.23)
131
- rake (>= 13.0.0)
132
- standard (1.39.2)
133
- language_server-protocol (~> 3.17.0.2)
134
- lint_roller (~> 1.0)
135
- rubocop (~> 1.64.0)
136
- standard-custom (~> 1.0.0)
137
- standard-performance (~> 1.4)
138
- standard-custom (1.0.2)
139
- lint_roller (~> 1.0)
140
- rubocop (~> 1.50)
141
- standard-performance (1.4.0)
142
- lint_roller (~> 1.1)
143
- rubocop-performance (~> 1.21.0)
144
- terminal-table (3.0.2)
145
- unicode-display_width (>= 1.1.1, < 3)
146
- tzinfo (2.0.6)
147
- concurrent-ruby (~> 1.0)
148
- unicode-display_width (2.4.2)
149
- webrick (1.8.1)
150
-
151
- PLATFORMS
152
- ruby
153
-
154
- DEPENDENCIES
155
- activesupport
156
- api_cache
157
- icalendar (~> 2.10.1)
158
- icalendar-recurrence
159
- jekyll
160
- nokogiri
161
- rspec
162
- standard
163
-
164
- BUNDLED WITH
165
- 2.5.16
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
-
3
- rm -f *.gem
4
- bundle exec gem build jekyll-ical-tag.gemspec
5
- bundle exec gem push jekyll-ical-tag-*.gem
data/bin/rspec DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rspec' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rspec-core", "rspec")
data/bin/standardrb DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'standardrb' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("standard", "standardrb")