jekyll-ical-tag 1.5.1 → 1.6.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 +4 -4
- data/.github/workflows/build.yml +39 -0
- data/Gemfile +9 -7
- data/Gemfile.lock +46 -1
- data/README.md +7 -2
- data/bin/standardrb +29 -0
- data/jekyll-ical-tag.gemspec +3 -2
- data/lib/jekyll-ical-tag/calendar_feed_coordinator.rb +12 -3
- data/lib/jekyll-ical-tag/calendar_fetcher.rb +1 -2
- data/lib/jekyll-ical-tag/calendar_limiter.rb +6 -8
- data/lib/jekyll-ical-tag/calendar_parser.rb +37 -6
- data/lib/jekyll-ical-tag/event.rb +7 -7
- data/lib/jekyll-ical-tag/version.rb +1 -1
- data/lib/jekyll-ical-tag.rb +34 -13
- metadata +19 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b71de33f80f9e2ff9554027bea500fa7e66d68468aaed22e539e4551b5e2132
|
|
4
|
+
data.tar.gz: 130b7534016609598f51c37216a95c36993c78e0e75569107f5eb521d12a4e31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70b795e541f7c3b15f588d606e0f5aaf0734a9e0fae90a6980b2fdafbd871d2e97a25e772aec02faa16441ff828acc6fb3d9afa36e6d66cc2307c9868504ec3f
|
|
7
|
+
data.tar.gz: eaaf3787045379728460e53d317becabf502cc9382e41cb60ff4a965ad264a5292acf25f2b7d325bb53eda68ccca1bb830322438f66b6ed9fdd2af582ab046fa
|
|
@@ -0,0 +1,39 @@
|
|
|
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/Gemfile
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
gem
|
|
3
|
+
gem "jekyll", require: false
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
-
gem
|
|
5
|
+
gem "activesupport"
|
|
6
|
+
gem "api_cache"
|
|
7
|
+
gem "icalendar", "~> 2.10.1"
|
|
8
|
+
gem "icalendar-recurrence"
|
|
8
9
|
|
|
9
10
|
group :development, :test do
|
|
10
|
-
gem
|
|
11
|
-
gem
|
|
11
|
+
gem "rspec"
|
|
12
|
+
gem "nokogiri"
|
|
13
|
+
gem "standard"
|
|
12
14
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -14,6 +14,7 @@ GEM
|
|
|
14
14
|
addressable (2.8.4)
|
|
15
15
|
public_suffix (>= 2.0.2, < 6.0)
|
|
16
16
|
api_cache (0.3.0)
|
|
17
|
+
ast (2.4.2)
|
|
17
18
|
base64 (0.2.0)
|
|
18
19
|
bigdecimal (3.1.6)
|
|
19
20
|
colorator (1.1.0)
|
|
@@ -34,6 +35,10 @@ GEM
|
|
|
34
35
|
concurrent-ruby (~> 1.0)
|
|
35
36
|
icalendar (2.10.1)
|
|
36
37
|
ice_cube (~> 0.16)
|
|
38
|
+
icalendar-recurrence (1.2.0)
|
|
39
|
+
icalendar (~> 2.0)
|
|
40
|
+
ice_cube (~> 0.16)
|
|
41
|
+
tzinfo (~> 2.0)
|
|
37
42
|
ice_cube (0.16.4)
|
|
38
43
|
jekyll (4.3.2)
|
|
39
44
|
addressable (~> 2.4)
|
|
@@ -55,10 +60,13 @@ GEM
|
|
|
55
60
|
sass-embedded (~> 1.54)
|
|
56
61
|
jekyll-watch (2.2.1)
|
|
57
62
|
listen (~> 3.0)
|
|
63
|
+
json (2.7.2)
|
|
58
64
|
kramdown (2.4.0)
|
|
59
65
|
rexml
|
|
60
66
|
kramdown-parser-gfm (1.1.0)
|
|
61
67
|
kramdown (~> 2.0)
|
|
68
|
+
language_server-protocol (3.17.0.3)
|
|
69
|
+
lint_roller (1.1.0)
|
|
62
70
|
liquid (4.0.4)
|
|
63
71
|
listen (3.8.0)
|
|
64
72
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
@@ -70,14 +78,20 @@ GEM
|
|
|
70
78
|
nokogiri (1.15.2)
|
|
71
79
|
mini_portile2 (~> 2.8.2)
|
|
72
80
|
racc (~> 1.4)
|
|
81
|
+
parallel (1.25.1)
|
|
82
|
+
parser (3.3.4.0)
|
|
83
|
+
ast (~> 2.4.1)
|
|
84
|
+
racc
|
|
73
85
|
pathutil (0.16.2)
|
|
74
86
|
forwardable-extended (~> 2.6)
|
|
75
87
|
public_suffix (5.0.1)
|
|
76
88
|
racc (1.7.1)
|
|
89
|
+
rainbow (3.1.1)
|
|
77
90
|
rake (13.0.6)
|
|
78
91
|
rb-fsevent (0.11.2)
|
|
79
92
|
rb-inotify (0.10.1)
|
|
80
93
|
ffi (~> 1.0)
|
|
94
|
+
regexp_parser (2.9.2)
|
|
81
95
|
rexml (3.2.5)
|
|
82
96
|
rouge (4.1.2)
|
|
83
97
|
rspec (3.12.0)
|
|
@@ -93,11 +107,40 @@ GEM
|
|
|
93
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
94
108
|
rspec-support (~> 3.12.0)
|
|
95
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)
|
|
96
127
|
ruby2_keywords (0.0.5)
|
|
97
128
|
safe_yaml (1.0.5)
|
|
98
129
|
sass-embedded (1.63.6)
|
|
99
130
|
google-protobuf (~> 3.23)
|
|
100
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)
|
|
101
144
|
terminal-table (3.0.2)
|
|
102
145
|
unicode-display_width (>= 1.1.1, < 3)
|
|
103
146
|
tzinfo (2.0.6)
|
|
@@ -112,9 +155,11 @@ DEPENDENCIES
|
|
|
112
155
|
activesupport
|
|
113
156
|
api_cache
|
|
114
157
|
icalendar (~> 2.10.1)
|
|
158
|
+
icalendar-recurrence
|
|
115
159
|
jekyll
|
|
116
160
|
nokogiri
|
|
117
161
|
rspec
|
|
162
|
+
standard
|
|
118
163
|
|
|
119
164
|
BUNDLED WITH
|
|
120
|
-
2.
|
|
165
|
+
2.5.16
|
data/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](https://github.com/Rakefire/jekyll-ical-tag/actions)
|
|
2
|
+
|
|
1
3
|
# Jekyll ical tag
|
|
2
4
|
|
|
3
5
|
Author: Ricky Chilcott https://www.rakefire.io
|
|
@@ -38,9 +40,12 @@ plugins:
|
|
|
38
40
|
- `only_future` - Defaults to 'false', limits returned events to start_time after now.
|
|
39
41
|
|
|
40
42
|
- `before_date` - limits returned events to dates before a specific date. This gets parsed with Ruby's Time.parse (e.g. 01-01-2018)
|
|
41
|
-
- `after_date` - limits returned events to dates
|
|
43
|
+
- `after_date` - limits returned events to dates after a specific date. This gets parsed with Ruby's Time.parse (e.g. 01-01-2018).
|
|
42
44
|
- `limit` - limits the number of returned events to the first N events matching the specified criteria. For example, `{% ical url: https://example.com/events.ics only_future:true limit:5 %}` returns the first five future events.
|
|
43
45
|
|
|
46
|
+
- `recurring_start_date` - limits returned events to recurring occurances after a specific date. If you don't have recurring events in your feed, you can ignore it. Deafults to 'today'
|
|
47
|
+
- `recurring_end_date` - limits returned events to recurring occurances before a specific date. If you don't have recurring events in your feed, you can ignore it. Deafults to '1 year from today'
|
|
48
|
+
|
|
44
49
|
## Event Attributes:
|
|
45
50
|
|
|
46
51
|
All RFC 5545 properties are supported, examples:
|
|
@@ -61,4 +66,4 @@ A few helper properties are also supported:
|
|
|
61
66
|
|
|
62
67
|
# Special Thanks
|
|
63
68
|
|
|
64
|
-
Special thanks to the following contributors: @marchehab98 @meitar
|
|
69
|
+
Special thanks to the following contributors: [@marchehab98](github.com/marchehab98] [@meitar](github.com/meitar) [@whatnotery](github.com/whatnotery)
|
data/bin/standardrb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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")
|
data/jekyll-ical-tag.gemspec
CHANGED
|
@@ -25,15 +25,16 @@ 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
|
|
28
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
29
29
|
spec.bindir = "exe"
|
|
30
|
-
spec.executables = spec.files.grep(%r
|
|
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
35
|
spec.add_dependency "activesupport", "~> 7.1"
|
|
36
36
|
spec.add_dependency "icalendar", "~> 2.10.1"
|
|
37
|
+
spec.add_dependency "icalendar-recurrence"
|
|
37
38
|
|
|
38
39
|
spec.add_development_dependency "bundler", "~> 1.15"
|
|
39
40
|
spec.add_development_dependency "rspec", "~> 3.5"
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
1
|
# frozen_string_literal: true
|
|
3
2
|
|
|
4
3
|
module Jekyll
|
|
5
4
|
class IcalTag
|
|
6
5
|
class CalendarFeedCoordinator
|
|
7
|
-
def initialize(url:, only: nil, reverse: nil, before_date: nil, after_date: nil, limit: nil)
|
|
6
|
+
def initialize(url:, only: nil, reverse: nil, before_date: nil, after_date: nil, limit: nil, recurring_start_date: nil, recurring_end_date: nil)
|
|
8
7
|
@url = url
|
|
9
8
|
@only = only
|
|
10
9
|
@reverse = reverse
|
|
11
10
|
@before_date = before_date
|
|
12
11
|
@after_date = after_date
|
|
13
12
|
@limit = limit
|
|
13
|
+
@recurring_start_date = recurring_start_date
|
|
14
|
+
@recurring_end_date = recurring_end_date
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def events
|
|
@@ -27,7 +28,7 @@ module Jekyll
|
|
|
27
28
|
|
|
28
29
|
def parser
|
|
29
30
|
@parser ||= begin
|
|
30
|
-
parser = CalendarParser.new(raw_ical)
|
|
31
|
+
parser = CalendarParser.new(raw_ical, recurring_start_date: recurring_start_date, recurring_end_date: recurring_end_date)
|
|
31
32
|
parser = CalendarLimiter.new(parser, only: only)
|
|
32
33
|
parser = CalendarLimiter.new(parser, reverse: reverse)
|
|
33
34
|
parser = CalendarLimiter.new(parser, before_date: before_date)
|
|
@@ -35,6 +36,14 @@ module Jekyll
|
|
|
35
36
|
CalendarLimiter.new(parser, limit: limit)
|
|
36
37
|
end
|
|
37
38
|
end
|
|
39
|
+
|
|
40
|
+
def recurring_start_date
|
|
41
|
+
@recurring_start_date || after_date || Date.today
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def recurring_end_date
|
|
45
|
+
@recurring_end_date || before_date || (recurring_start_date + 1.year)
|
|
46
|
+
end
|
|
38
47
|
end
|
|
39
48
|
end
|
|
40
49
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
1
|
# frozen_string_literal: true
|
|
3
2
|
|
|
4
3
|
module Jekyll
|
|
@@ -10,28 +9,27 @@ module Jekyll
|
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
def events
|
|
13
|
-
|
|
14
|
-
when options[:only] == :future
|
|
12
|
+
if options[:only] == :future
|
|
15
13
|
now = Time.now
|
|
16
14
|
parser.events.select do |event|
|
|
17
15
|
event.dtstart.to_time >= now
|
|
18
16
|
end
|
|
19
|
-
|
|
17
|
+
elsif options[:only] == :past
|
|
20
18
|
now = Time.now
|
|
21
19
|
parser.events.select do |event|
|
|
22
20
|
event.dtstart.to_time < now
|
|
23
21
|
end
|
|
24
|
-
|
|
22
|
+
elsif options[:reverse]
|
|
25
23
|
parser.events.reverse
|
|
26
|
-
|
|
24
|
+
elsif options[:after_date]
|
|
27
25
|
parser.events.select do |event|
|
|
28
26
|
event.dtstart.to_time >= options[:after_date]
|
|
29
27
|
end
|
|
30
|
-
|
|
28
|
+
elsif options[:before_date]
|
|
31
29
|
parser.events.select do |event|
|
|
32
30
|
event.dtstart.to_time < options[:before_date]
|
|
33
31
|
end
|
|
34
|
-
|
|
32
|
+
elsif options[:limit]
|
|
35
33
|
parser.events.first(options[:limit])
|
|
36
34
|
else
|
|
37
35
|
parser.events
|
|
@@ -1,25 +1,56 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
1
|
# frozen_string_literal: true
|
|
3
2
|
|
|
4
3
|
require "active_support"
|
|
5
4
|
require "icalendar"
|
|
5
|
+
require "icalendar/recurrence"
|
|
6
6
|
|
|
7
7
|
module Jekyll
|
|
8
8
|
class IcalTag
|
|
9
9
|
class CalendarParser
|
|
10
|
-
def initialize(raw_feed)
|
|
10
|
+
def initialize(raw_feed, recurring_start_date:, recurring_end_date:)
|
|
11
11
|
@raw_feed = raw_feed
|
|
12
|
+
@recurring_start_date = recurring_start_date
|
|
13
|
+
@recurring_end_date = recurring_end_date
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
def events
|
|
15
|
-
@events ||=
|
|
16
|
-
|
|
17
|
+
@events ||=
|
|
18
|
+
parsed_events
|
|
19
|
+
.sort_by(&:dtstart)
|
|
20
|
+
.map { |event| Jekyll::IcalTag::Event.new(event) }
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
private
|
|
20
24
|
|
|
21
|
-
def
|
|
22
|
-
Icalendar::Event.parse(@raw_feed)
|
|
25
|
+
def parsed_events
|
|
26
|
+
events = Icalendar::Event.parse(@raw_feed)
|
|
27
|
+
|
|
28
|
+
recurring_events =
|
|
29
|
+
events
|
|
30
|
+
.select { |event| event.rrule.present? }
|
|
31
|
+
.flat_map do |event|
|
|
32
|
+
event
|
|
33
|
+
.occurrences_between(@recurring_start_date, @recurring_end_date)
|
|
34
|
+
.map { |occurrence| build_occurance_event(event, occurrence) }
|
|
35
|
+
end
|
|
36
|
+
.compact
|
|
37
|
+
|
|
38
|
+
events.concat(recurring_events)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# return a new event with the same attributes, but different start and end times
|
|
42
|
+
def build_occurance_event(event, occurrence)
|
|
43
|
+
return if is_duplicate_event?(event, occurrence)
|
|
44
|
+
|
|
45
|
+
event.dup.tap do |e|
|
|
46
|
+
e.dtstart = occurrence.start_time
|
|
47
|
+
e.dtend = occurrence.end_time
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def is_duplicate_event?(event, occurrence)
|
|
52
|
+
event.dtstart.to_time == occurrence.start_time.to_time ||
|
|
53
|
+
event.dtend.to_time == occurrence.end_time.to_time
|
|
23
54
|
end
|
|
24
55
|
end
|
|
25
56
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
1
|
# frozen_string_literal: true
|
|
3
2
|
|
|
4
3
|
require "uri"
|
|
@@ -39,17 +38,18 @@ module Jekyll
|
|
|
39
38
|
attr_reader :all_properties
|
|
40
39
|
|
|
41
40
|
def simple_html_description
|
|
42
|
-
@simple_html_description ||=
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
description.gsub! url, %(<a href='#{url}'>#{url}</a>)
|
|
46
|
-
end
|
|
41
|
+
@simple_html_description ||= description.clone.tap do |description|
|
|
42
|
+
description_urls.each do |url|
|
|
43
|
+
description.gsub! url, %(<a href='#{url}'>#{url}</a>)
|
|
47
44
|
end
|
|
48
45
|
end
|
|
49
46
|
end
|
|
50
47
|
|
|
51
48
|
def attendees
|
|
52
|
-
ical_event.attendee.map(&:to_s).map { |a|
|
|
49
|
+
ical_event.attendee.map(&:to_s).map { |a|
|
|
50
|
+
a.slice!("mailto:")
|
|
51
|
+
a
|
|
52
|
+
}
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def description_urls
|
data/lib/jekyll-ical-tag.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
1
|
# frozen_string_literal: true
|
|
3
2
|
|
|
4
3
|
require "jekyll"
|
|
@@ -26,19 +25,27 @@ module Jekyll
|
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def render(context)
|
|
28
|
+
self.context = context
|
|
29
29
|
context.registers[:ical] ||= Hash.new(0)
|
|
30
30
|
|
|
31
|
+
set_recurring_dates!
|
|
32
|
+
|
|
31
33
|
result = []
|
|
32
34
|
|
|
33
35
|
context.stack do
|
|
34
|
-
url = dereferenced_liquid_val(
|
|
35
|
-
before_date = before_date_from
|
|
36
|
-
after_date = after_date_from
|
|
36
|
+
url = dereferenced_liquid_val("url")
|
|
37
|
+
before_date = before_date_from
|
|
38
|
+
after_date = after_date_from
|
|
37
39
|
|
|
38
40
|
calendar_feed_coordinator = CalendarFeedCoordinator.new(
|
|
39
|
-
url: url,
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
url: url,
|
|
42
|
+
only: @only,
|
|
43
|
+
reverse: @reverse,
|
|
44
|
+
before_date: before_date,
|
|
45
|
+
after_date: after_date,
|
|
46
|
+
limit: @limit,
|
|
47
|
+
recurring_start_date: @recurring_start_date,
|
|
48
|
+
recurring_end_date: @recurring_end_date
|
|
42
49
|
)
|
|
43
50
|
events = calendar_feed_coordinator.events
|
|
44
51
|
event_count = events.length
|
|
@@ -72,7 +79,7 @@ module Jekyll
|
|
|
72
79
|
"rindex" => event_count - index,
|
|
73
80
|
"rindex0" => event_count - index - 1,
|
|
74
81
|
"first" => (index == 0),
|
|
75
|
-
"last" => (index == event_count - 1)
|
|
82
|
+
"last" => (index == event_count - 1)
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
result << nodelist.map do |n|
|
|
@@ -90,15 +97,17 @@ module Jekyll
|
|
|
90
97
|
|
|
91
98
|
private
|
|
92
99
|
|
|
93
|
-
|
|
100
|
+
attr_accessor :context
|
|
101
|
+
|
|
102
|
+
def after_date_from
|
|
94
103
|
safely_cast_to_time(
|
|
95
|
-
dereferenced_liquid_val(
|
|
104
|
+
dereferenced_liquid_val("after_date")
|
|
96
105
|
)
|
|
97
106
|
end
|
|
98
107
|
|
|
99
|
-
def before_date_from
|
|
108
|
+
def before_date_from
|
|
100
109
|
safely_cast_to_time(
|
|
101
|
-
dereferenced_liquid_val(
|
|
110
|
+
dereferenced_liquid_val("before_date")
|
|
102
111
|
)
|
|
103
112
|
end
|
|
104
113
|
|
|
@@ -115,7 +124,7 @@ module Jekyll
|
|
|
115
124
|
end
|
|
116
125
|
end
|
|
117
126
|
|
|
118
|
-
def dereferenced_liquid_val(
|
|
127
|
+
def dereferenced_liquid_val(variable_name)
|
|
119
128
|
raw_value = @attributes[variable_name]
|
|
120
129
|
|
|
121
130
|
context.key?(raw_value) ? context[raw_value] : raw_value
|
|
@@ -151,6 +160,18 @@ module Jekyll
|
|
|
151
160
|
:all
|
|
152
161
|
end
|
|
153
162
|
end
|
|
163
|
+
|
|
164
|
+
def set_recurring_dates!
|
|
165
|
+
@recurring_end_date =
|
|
166
|
+
safely_cast_to_time(
|
|
167
|
+
dereferenced_liquid_val("recurring_end_date")
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
@recurring_start_date =
|
|
171
|
+
safely_cast_to_time(
|
|
172
|
+
dereferenced_liquid_val("recurring_start_date")
|
|
173
|
+
)
|
|
174
|
+
end
|
|
154
175
|
end
|
|
155
176
|
end
|
|
156
177
|
|
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.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ricky Chilcott
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -66,6 +66,20 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: 2.10.1
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: icalendar-recurrence
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: bundler
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -101,6 +115,7 @@ executables: []
|
|
|
101
115
|
extensions: []
|
|
102
116
|
extra_rdoc_files: []
|
|
103
117
|
files:
|
|
118
|
+
- ".github/workflows/build.yml"
|
|
104
119
|
- ".gitignore"
|
|
105
120
|
- ".rspec"
|
|
106
121
|
- ".tool-versions"
|
|
@@ -109,6 +124,7 @@ files:
|
|
|
109
124
|
- README.md
|
|
110
125
|
- bin/build-and-publish-gem
|
|
111
126
|
- bin/rspec
|
|
127
|
+
- bin/standardrb
|
|
112
128
|
- jekyll-ical-tag.gemspec
|
|
113
129
|
- lib/jekyll-ical-tag.rb
|
|
114
130
|
- lib/jekyll-ical-tag/calendar_feed_coordinator.rb
|
|
@@ -137,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
137
153
|
- !ruby/object:Gem::Version
|
|
138
154
|
version: '0'
|
|
139
155
|
requirements: []
|
|
140
|
-
rubygems_version: 3.5.
|
|
156
|
+
rubygems_version: 3.5.9
|
|
141
157
|
signing_key:
|
|
142
158
|
specification_version: 4
|
|
143
159
|
summary: A Jekyll plugin to pull ICS feed and provide a for-like loop of calendar
|