jekyll-ical-tag 1.4.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +33 -21
- data/jekyll-ical-tag.gemspec +2 -2
- data/lib/jekyll-ical-tag/event.rb +2 -1
- data/lib/jekyll-ical-tag/version.rb +1 -1
- metadata +11 -27
- data/_site/README.md +0 -64
- data/_site/bin/build-and-publish-gem +0 -5
- data/_site/bin/rspec +0 -29
- data/_site/jekyll-ical-tag.gemspec +0 -40
- data/_site/lib/jekyll-ical-tag/calendar_feed_coordinator.rb +0 -40
- data/_site/lib/jekyll-ical-tag/calendar_fetcher.rb +0 -30
- data/_site/lib/jekyll-ical-tag/calendar_limiter.rb +0 -46
- data/_site/lib/jekyll-ical-tag/calendar_parser.rb +0 -26
- data/_site/lib/jekyll-ical-tag/event.rb +0 -111
- data/_site/lib/jekyll-ical-tag/version.rb +0 -7
- data/_site/lib/jekyll-ical-tag.rb +0 -169
- data/_site/spec/calendar_feed_coordinator_spec.rb +0 -219
- data/_site/spec/spec_helper.rb +0 -85
- data/_site/spec/support/basic.ics +0 -1310
- data/_site/spec/support/italian.ics +0 -155
- data/_site/spec/support/sesh.ics +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e12845744cce14e1ec5537ff8441fa364e001443c396a66dbc85a16f03bbfac
|
4
|
+
data.tar.gz: afbefb0515a7b9f5fc4c2b8f998488e3da03bfa8b03591b53944b41559848947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cacc0f5a846afab872099b0681c784c831eef23e09606e2e9bb989feaf527539cbcca91fe087c906d253ef7481a1a24ccd422ea6f3e5554a67e634f729ca2ec
|
7
|
+
data.tar.gz: a30558531827aab593381b88b0e3b943c0405d2993c1abeb5605930566de7665be5f77854a1080305aa0b74f7e57403d99e7e11181478ee32a8a9d62e81f123e
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,28 +1,38 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (7.
|
4
|
+
activesupport (7.1.3.2)
|
5
|
+
base64
|
6
|
+
bigdecimal
|
5
7
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
8
|
+
connection_pool (>= 2.2.5)
|
9
|
+
drb
|
6
10
|
i18n (>= 1.6, < 2)
|
7
11
|
minitest (>= 5.1)
|
12
|
+
mutex_m
|
8
13
|
tzinfo (~> 2.0)
|
9
|
-
addressable (2.8.
|
14
|
+
addressable (2.8.4)
|
10
15
|
public_suffix (>= 2.0.2, < 6.0)
|
11
16
|
api_cache (0.3.0)
|
17
|
+
base64 (0.2.0)
|
18
|
+
bigdecimal (3.1.6)
|
12
19
|
colorator (1.1.0)
|
13
|
-
concurrent-ruby (1.2.
|
20
|
+
concurrent-ruby (1.2.3)
|
21
|
+
connection_pool (2.4.1)
|
14
22
|
diff-lcs (1.5.0)
|
23
|
+
drb (2.2.0)
|
24
|
+
ruby2_keywords
|
15
25
|
em-websocket (0.5.3)
|
16
26
|
eventmachine (>= 0.12.9)
|
17
27
|
http_parser.rb (~> 0)
|
18
28
|
eventmachine (1.2.7)
|
19
29
|
ffi (1.15.5)
|
20
30
|
forwardable-extended (2.6.0)
|
21
|
-
google-protobuf (3.
|
31
|
+
google-protobuf (3.23.3)
|
22
32
|
http_parser.rb (0.8.0)
|
23
|
-
i18n (1.
|
33
|
+
i18n (1.14.1)
|
24
34
|
concurrent-ruby (~> 1.0)
|
25
|
-
icalendar (2.
|
35
|
+
icalendar (2.10.1)
|
26
36
|
ice_cube (~> 0.16)
|
27
37
|
ice_cube (0.16.4)
|
28
38
|
jekyll (4.3.2)
|
@@ -54,38 +64,40 @@ GEM
|
|
54
64
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
55
65
|
rb-inotify (~> 0.9, >= 0.9.10)
|
56
66
|
mercenary (0.4.0)
|
57
|
-
mini_portile2 (2.8.
|
58
|
-
minitest (5.
|
59
|
-
|
60
|
-
|
67
|
+
mini_portile2 (2.8.2)
|
68
|
+
minitest (5.22.2)
|
69
|
+
mutex_m (0.2.0)
|
70
|
+
nokogiri (1.15.2)
|
71
|
+
mini_portile2 (~> 2.8.2)
|
61
72
|
racc (~> 1.4)
|
62
73
|
pathutil (0.16.2)
|
63
74
|
forwardable-extended (~> 2.6)
|
64
75
|
public_suffix (5.0.1)
|
65
|
-
racc (1.
|
76
|
+
racc (1.7.1)
|
66
77
|
rake (13.0.6)
|
67
78
|
rb-fsevent (0.11.2)
|
68
79
|
rb-inotify (0.10.1)
|
69
80
|
ffi (~> 1.0)
|
70
81
|
rexml (3.2.5)
|
71
|
-
rouge (4.1.
|
82
|
+
rouge (4.1.2)
|
72
83
|
rspec (3.12.0)
|
73
84
|
rspec-core (~> 3.12.0)
|
74
85
|
rspec-expectations (~> 3.12.0)
|
75
86
|
rspec-mocks (~> 3.12.0)
|
76
|
-
rspec-core (3.12.
|
87
|
+
rspec-core (3.12.2)
|
77
88
|
rspec-support (~> 3.12.0)
|
78
|
-
rspec-expectations (3.12.
|
89
|
+
rspec-expectations (3.12.3)
|
79
90
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
91
|
rspec-support (~> 3.12.0)
|
81
|
-
rspec-mocks (3.12.
|
92
|
+
rspec-mocks (3.12.5)
|
82
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
94
|
rspec-support (~> 3.12.0)
|
84
|
-
rspec-support (3.12.
|
95
|
+
rspec-support (3.12.1)
|
96
|
+
ruby2_keywords (0.0.5)
|
85
97
|
safe_yaml (1.0.5)
|
86
|
-
sass-embedded (1.
|
87
|
-
google-protobuf (~> 3.
|
88
|
-
rake (>=
|
98
|
+
sass-embedded (1.63.6)
|
99
|
+
google-protobuf (~> 3.23)
|
100
|
+
rake (>= 13.0.0)
|
89
101
|
terminal-table (3.0.2)
|
90
102
|
unicode-display_width (>= 1.1.1, < 3)
|
91
103
|
tzinfo (2.0.6)
|
@@ -99,10 +111,10 @@ PLATFORMS
|
|
99
111
|
DEPENDENCIES
|
100
112
|
activesupport
|
101
113
|
api_cache
|
102
|
-
icalendar
|
114
|
+
icalendar (~> 2.10.1)
|
103
115
|
jekyll
|
104
116
|
nokogiri
|
105
117
|
rspec
|
106
118
|
|
107
119
|
BUNDLED WITH
|
108
|
-
2.
|
120
|
+
2.1.4
|
data/jekyll-ical-tag.gemspec
CHANGED
@@ -32,8 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_dependency "jekyll", "> 3"
|
34
34
|
spec.add_dependency "api_cache"
|
35
|
-
spec.add_dependency "activesupport"
|
36
|
-
spec.add_dependency "icalendar"
|
35
|
+
spec.add_dependency "activesupport", "~> 7.1"
|
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"
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require "uri"
|
5
5
|
require "active_support"
|
6
|
+
require "active_support/core_ext/object/blank"
|
6
7
|
|
7
8
|
module Jekyll
|
8
9
|
class IcalTag
|
@@ -80,7 +81,7 @@ module Jekyll
|
|
80
81
|
props.transform_values! do |value|
|
81
82
|
new_value =
|
82
83
|
case value
|
83
|
-
when Array, Icalendar::Values::Array
|
84
|
+
when Array, Icalendar::Values::Helpers::Array
|
84
85
|
value.join("\n").force_encoding("UTF-8")
|
85
86
|
when String, Icalendar::Values::Text
|
86
87
|
value.force_encoding("UTF-8")
|
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.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricky Chilcott
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '7.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '7.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: icalendar
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
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:
|
68
|
+
version: 2.10.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,22 +107,6 @@ files:
|
|
107
107
|
- Gemfile
|
108
108
|
- Gemfile.lock
|
109
109
|
- README.md
|
110
|
-
- _site/README.md
|
111
|
-
- _site/bin/build-and-publish-gem
|
112
|
-
- _site/bin/rspec
|
113
|
-
- _site/jekyll-ical-tag.gemspec
|
114
|
-
- _site/lib/jekyll-ical-tag.rb
|
115
|
-
- _site/lib/jekyll-ical-tag/calendar_feed_coordinator.rb
|
116
|
-
- _site/lib/jekyll-ical-tag/calendar_fetcher.rb
|
117
|
-
- _site/lib/jekyll-ical-tag/calendar_limiter.rb
|
118
|
-
- _site/lib/jekyll-ical-tag/calendar_parser.rb
|
119
|
-
- _site/lib/jekyll-ical-tag/event.rb
|
120
|
-
- _site/lib/jekyll-ical-tag/version.rb
|
121
|
-
- _site/spec/calendar_feed_coordinator_spec.rb
|
122
|
-
- _site/spec/spec_helper.rb
|
123
|
-
- _site/spec/support/basic.ics
|
124
|
-
- _site/spec/support/italian.ics
|
125
|
-
- _site/spec/support/sesh.ics
|
126
110
|
- bin/build-and-publish-gem
|
127
111
|
- bin/rspec
|
128
112
|
- jekyll-ical-tag.gemspec
|
@@ -153,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
137
|
- !ruby/object:Gem::Version
|
154
138
|
version: '0'
|
155
139
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.5.3
|
157
141
|
signing_key:
|
158
142
|
specification_version: 4
|
159
143
|
summary: A Jekyll plugin to pull ICS feed and provide a for-like loop of calendar
|
data/_site/README.md
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# Jekyll ical tag
|
2
|
-
|
3
|
-
Author: Ricky Chilcott https://www.rakefire.io
|
4
|
-
|
5
|
-
Description: Pull ICS feed and provide a for-like loop of calendar events
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
To your Gemfile:
|
10
|
-
|
11
|
-
`gem 'jekyll-ical-tag'`
|
12
|
-
|
13
|
-
To your `_config.yml`
|
14
|
-
|
15
|
-
```yml
|
16
|
-
plugins:
|
17
|
-
- jekyll-ical-tag
|
18
|
-
```
|
19
|
-
|
20
|
-
## Syntax
|
21
|
-
|
22
|
-
```html
|
23
|
-
{% ical url: https://space.floern.com/launch.ics reverse: true only_future: true %}
|
24
|
-
{{ event.summary }}
|
25
|
-
{{ event.description }}
|
26
|
-
{{ event.simple_html_description }}
|
27
|
-
{{ event.start_time }}
|
28
|
-
{{ event.end_time }}
|
29
|
-
{{ event.url }}
|
30
|
-
{{ event.attendees }}
|
31
|
-
{% endical %}
|
32
|
-
```
|
33
|
-
|
34
|
-
## Options
|
35
|
-
|
36
|
-
- `reverse` - Defaults to 'false', ordering events by start_time (or reverse start_time).
|
37
|
-
- `only_past` - Defaults to 'false', limits returned events to start_times before now.
|
38
|
-
- `only_future` - Defaults to 'false', limits returned events to start_time after now.
|
39
|
-
|
40
|
-
- `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 before a specific date. This gets parsed with Ruby's Time.parse (e.g. 01-01-2018).
|
42
|
-
- `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
|
-
|
44
|
-
## Event Attributes:
|
45
|
-
|
46
|
-
All RFC 5545 properties are supported, examples:
|
47
|
-
|
48
|
-
- `dtstart` - start time of event
|
49
|
-
- `dtend` - end time of event
|
50
|
-
- `summary` - Title or name of event
|
51
|
-
- `description` - Notes/description of event
|
52
|
-
- `location` - Location of event
|
53
|
-
- `url` - url of event, if provided, if not, take the first url from the description.
|
54
|
-
|
55
|
-
A few helper properties are also supported:
|
56
|
-
|
57
|
-
- `attendees` - [Array] of attendees names/emails
|
58
|
-
- `simple_html_description` - Notes/description of event with urls auto-linked
|
59
|
-
- `start_time` - start time of event
|
60
|
-
- `end_time` - end time of event
|
61
|
-
|
62
|
-
# Special Thanks
|
63
|
-
|
64
|
-
Special thanks to the following contributors: @marchehab98 @meitar
|
data/_site/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")
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path("lib", __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
|
6
|
-
require "jekyll"
|
7
|
-
require "jekyll-ical-tag/version"
|
8
|
-
|
9
|
-
Gem::Specification.new do |spec|
|
10
|
-
spec.name = "jekyll-ical-tag"
|
11
|
-
spec.version = Jekyll::IcalTag::VERSION
|
12
|
-
spec.authors = ["Ricky Chilcott"]
|
13
|
-
spec.email = ["ricky@rakefire.io"]
|
14
|
-
spec.summary = "A Jekyll plugin to pull ICS feed and provide a for-like loop of calendar events"
|
15
|
-
spec.homepage = "https://github.com/rakefire/jekyll-ical-tag"
|
16
|
-
spec.license = "MIT"
|
17
|
-
|
18
|
-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
19
|
-
# delete this section to allow pushing this gem to any host.
|
20
|
-
if spec.respond_to?(:metadata)
|
21
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
22
|
-
else
|
23
|
-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
24
|
-
end
|
25
|
-
|
26
|
-
spec.required_ruby_version = ">= 2.3.0"
|
27
|
-
|
28
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
|
29
|
-
spec.bindir = "exe"
|
30
|
-
spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = ["lib"]
|
32
|
-
|
33
|
-
spec.add_dependency "jekyll", "> 3"
|
34
|
-
spec.add_dependency "api_cache"
|
35
|
-
spec.add_dependency "activesupport"
|
36
|
-
spec.add_dependency "icalendar"
|
37
|
-
|
38
|
-
spec.add_development_dependency "bundler", "~> 1.15"
|
39
|
-
spec.add_development_dependency "rspec", "~> 3.5"
|
40
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Jekyll
|
5
|
-
class IcalTag
|
6
|
-
class CalendarFeedCoordinator
|
7
|
-
def initialize(url:, only: nil, reverse: nil, before_date: nil, after_date: nil, limit: nil)
|
8
|
-
@url = url
|
9
|
-
@only = only
|
10
|
-
@reverse = reverse
|
11
|
-
@before_date = before_date
|
12
|
-
@after_date = after_date
|
13
|
-
@limit = limit
|
14
|
-
end
|
15
|
-
|
16
|
-
def events
|
17
|
-
parser.events
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
attr_reader :url, :only, :reverse, :before_date, :after_date, :limit
|
23
|
-
|
24
|
-
def raw_ical
|
25
|
-
@raw_ical ||= CalendarFetcher.new(url).fetch
|
26
|
-
end
|
27
|
-
|
28
|
-
def parser
|
29
|
-
@parser ||= begin
|
30
|
-
parser = CalendarParser.new(raw_ical)
|
31
|
-
parser = CalendarLimiter.new(parser, only: only)
|
32
|
-
parser = CalendarLimiter.new(parser, reverse: reverse)
|
33
|
-
parser = CalendarLimiter.new(parser, before_date: before_date)
|
34
|
-
parser = CalendarLimiter.new(parser, after_date: after_date)
|
35
|
-
CalendarLimiter.new(parser, limit: limit)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "cgi"
|
5
|
-
require "api_cache"
|
6
|
-
|
7
|
-
module Jekyll
|
8
|
-
class IcalTag
|
9
|
-
class CalendarFetcher
|
10
|
-
def initialize(url)
|
11
|
-
@url = CGI.unescape(url)
|
12
|
-
|
13
|
-
raise "No URL provided or in innapropriate form '#{url}'" unless is_valid_url?
|
14
|
-
end
|
15
|
-
|
16
|
-
def fetch
|
17
|
-
puts "Fetching #{url}"
|
18
|
-
@fetch ||= APICache.get(url)
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
attr_reader :url
|
24
|
-
|
25
|
-
def is_valid_url?
|
26
|
-
!!(url =~ URI::regexp)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Jekyll
|
5
|
-
class IcalTag
|
6
|
-
class CalendarLimiter
|
7
|
-
def initialize(parser, options = {})
|
8
|
-
@parser = parser
|
9
|
-
@options = options
|
10
|
-
end
|
11
|
-
|
12
|
-
def events
|
13
|
-
case
|
14
|
-
when options[:only] == :future
|
15
|
-
now = Time.now
|
16
|
-
parser.events.select do |event|
|
17
|
-
event.dtstart.to_time >= now
|
18
|
-
end
|
19
|
-
when options[:only] == :past
|
20
|
-
now = Time.now
|
21
|
-
parser.events.select do |event|
|
22
|
-
event.dtstart.to_time < now
|
23
|
-
end
|
24
|
-
when options[:reverse]
|
25
|
-
parser.events.reverse
|
26
|
-
when options[:after_date]
|
27
|
-
parser.events.select do |event|
|
28
|
-
event.dtstart.to_time >= options[:after_date]
|
29
|
-
end
|
30
|
-
when options[:before_date]
|
31
|
-
parser.events.select do |event|
|
32
|
-
event.dtstart.to_time < options[:before_date]
|
33
|
-
end
|
34
|
-
when options[:limit]
|
35
|
-
parser.events.first(options[:limit])
|
36
|
-
else
|
37
|
-
parser.events
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
attr_reader :parser, :options
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "active_support"
|
5
|
-
require "icalendar"
|
6
|
-
|
7
|
-
module Jekyll
|
8
|
-
class IcalTag
|
9
|
-
class CalendarParser
|
10
|
-
def initialize(raw_feed)
|
11
|
-
@raw_feed = raw_feed
|
12
|
-
end
|
13
|
-
|
14
|
-
def events
|
15
|
-
@events ||= parsed_feed.sort { |event1, event2| event1.dtstart <=> event2.dtstart }
|
16
|
-
.map { |event| Jekyll::IcalTag::Event.new(event) }
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def parsed_feed
|
22
|
-
Icalendar::Event.parse(@raw_feed)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "uri"
|
5
|
-
require "active_support"
|
6
|
-
|
7
|
-
module Jekyll
|
8
|
-
class IcalTag
|
9
|
-
class Event
|
10
|
-
URL_REGEX = /
|
11
|
-
(?:(?:https?|ftp):\/\/) # Allowable schemes
|
12
|
-
(?:\S+(?::\S*)?@)? # username:password, which is optional
|
13
|
-
(?: # Domain part follows; non-capturing
|
14
|
-
# These IP addresses are valid domain values
|
15
|
-
(?!10(?:\.\d{1,3}){3})
|
16
|
-
(?!127(?:\.\d{1,3}){3})
|
17
|
-
(?!169\.254(?:\.\d{1,3}){2})
|
18
|
-
(?!192\.168(?:\.\d{1,3}){2})
|
19
|
-
(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})
|
20
|
-
(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])
|
21
|
-
(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}
|
22
|
-
(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))
|
23
|
-
|
|
24
|
-
(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)
|
25
|
-
(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*
|
26
|
-
(?:\.(?:[a-z\u00a1-\uffff]{2,}))
|
27
|
-
)
|
28
|
-
(?::\d{2,5})? # Optional port number
|
29
|
-
(?:\/[^\s"]*)? # Anything that is not a space or a double quote
|
30
|
-
/x
|
31
|
-
|
32
|
-
def initialize(ical_event)
|
33
|
-
@ical_event = ical_event
|
34
|
-
setup_all_properties!
|
35
|
-
setup_property_accessor_methods!
|
36
|
-
end
|
37
|
-
|
38
|
-
attr_reader :all_properties
|
39
|
-
|
40
|
-
def simple_html_description
|
41
|
-
@simple_html_description ||= begin
|
42
|
-
description.clone.tap do |description|
|
43
|
-
description_urls.each do |url|
|
44
|
-
description.gsub! url, %(<a href='#{url}'>#{url}</a>)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def attendees
|
51
|
-
ical_event.attendee.map(&:to_s).map { |a| a.slice!("mailto:"); a }
|
52
|
-
end
|
53
|
-
|
54
|
-
def description_urls
|
55
|
-
return [] unless description
|
56
|
-
|
57
|
-
@description_urls ||= description.scan(URL_REGEX).to_a
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
attr_reader :ical_event
|
63
|
-
|
64
|
-
def setup_all_properties!
|
65
|
-
@all_properties ||= begin
|
66
|
-
props = {}
|
67
|
-
|
68
|
-
# RFC 5545 Properties
|
69
|
-
ical_event.class.properties.each do |property|
|
70
|
-
props[property] = ical_event.property(property)
|
71
|
-
end
|
72
|
-
|
73
|
-
# custom properties
|
74
|
-
props = props.merge(ical_event.custom_properties)
|
75
|
-
|
76
|
-
# Ensure all arrays get flattened to utf8 encoded strings
|
77
|
-
# Ensure all event values are utf8 encoded strings
|
78
|
-
# Ensure times (from dates)
|
79
|
-
# Ensure present
|
80
|
-
props.transform_values! do |value|
|
81
|
-
new_value =
|
82
|
-
case value
|
83
|
-
when Array, Icalendar::Values::Array
|
84
|
-
value.join("\n").force_encoding("UTF-8")
|
85
|
-
when String, Icalendar::Values::Text
|
86
|
-
value.force_encoding("UTF-8")
|
87
|
-
when Date, Icalendar::Values::DateTime
|
88
|
-
value.to_time
|
89
|
-
when Icalendar::Values::Uri
|
90
|
-
value.to_s
|
91
|
-
else
|
92
|
-
value
|
93
|
-
end
|
94
|
-
|
95
|
-
new_value.presence
|
96
|
-
end
|
97
|
-
|
98
|
-
props
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def setup_property_accessor_methods!
|
103
|
-
all_properties.each do |prop, value|
|
104
|
-
define_singleton_method prop do
|
105
|
-
all_properties[prop]
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|