jekyll-ical-tag 1.0.9 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +8 -12
- data/README.md +10 -3
- data/jekyll-ical-tag.gemspec +0 -1
- data/lib/jekyll-ical-tag.rb +55 -49
- data/lib/jekyll-ical-tag/event.rb +41 -4
- data/lib/jekyll-ical-tag/version.rb +1 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299387790191b2247ec79cfed707a29b6e1e6f52585f5abaff7de47b9706dae7
|
4
|
+
data.tar.gz: 8123a5b839ec83de6a63a11a7fbcf9a2b1318ae9c1b4713a85561dacb83948a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c890d519e3f4922732f9f086fc73e97e1fec970379f256ef35c337793cc4e2e4c0f08b63a9e5843e89b5e76e9f87b70bbd326a59d24828d9c8ee05256d0be19c
|
7
|
+
data.tar.gz: cb75fe2e7b9d45a2d75168fd32db14566f1811bef15534f6af428db700acf6f3c76f4fc1a5de43432adda7c834f50ec09aa82a69dc68cd22bb64ddc6facaec04
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (5.2.
|
4
|
+
activesupport (5.2.4.3)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 0.7, < 2)
|
7
7
|
minitest (~> 5.1)
|
@@ -9,9 +9,8 @@ GEM
|
|
9
9
|
addressable (2.7.0)
|
10
10
|
public_suffix (>= 2.0.2, < 5.0)
|
11
11
|
api_cache (0.3.0)
|
12
|
-
coderay (1.1.2)
|
13
12
|
colorator (1.1.0)
|
14
|
-
concurrent-ruby (1.
|
13
|
+
concurrent-ruby (1.1.6)
|
15
14
|
diff-lcs (1.3)
|
16
15
|
em-websocket (0.5.1)
|
17
16
|
eventmachine (>= 0.12.9)
|
@@ -20,7 +19,7 @@ GEM
|
|
20
19
|
ffi (1.12.2)
|
21
20
|
forwardable-extended (2.6.0)
|
22
21
|
http_parser.rb (0.6.0)
|
23
|
-
i18n (1.
|
22
|
+
i18n (1.8.2)
|
24
23
|
concurrent-ruby (~> 1.0)
|
25
24
|
icalendar (2.5.0)
|
26
25
|
ice_cube (~> 0.16)
|
@@ -44,7 +43,8 @@ GEM
|
|
44
43
|
sassc (> 2.0.1, < 3.0)
|
45
44
|
jekyll-watch (2.2.1)
|
46
45
|
listen (~> 3.0)
|
47
|
-
kramdown (2.
|
46
|
+
kramdown (2.3.0)
|
47
|
+
rexml
|
48
48
|
kramdown-parser-gfm (1.1.0)
|
49
49
|
kramdown (~> 2.0)
|
50
50
|
liquid (4.0.3)
|
@@ -52,20 +52,17 @@ GEM
|
|
52
52
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
53
53
|
rb-inotify (~> 0.9, >= 0.9.10)
|
54
54
|
mercenary (0.3.6)
|
55
|
-
method_source (0.9.0)
|
56
55
|
mini_portile2 (2.4.0)
|
57
|
-
minitest (5.
|
56
|
+
minitest (5.14.1)
|
58
57
|
nokogiri (1.10.8)
|
59
58
|
mini_portile2 (~> 2.4.0)
|
60
59
|
pathutil (0.16.2)
|
61
60
|
forwardable-extended (~> 2.6)
|
62
|
-
pry (0.11.3)
|
63
|
-
coderay (~> 1.1.0)
|
64
|
-
method_source (~> 0.9.0)
|
65
61
|
public_suffix (4.0.3)
|
66
62
|
rb-fsevent (0.10.3)
|
67
63
|
rb-inotify (0.10.1)
|
68
64
|
ffi (~> 1.0)
|
65
|
+
rexml (3.2.4)
|
69
66
|
rouge (3.17.0)
|
70
67
|
rspec (3.7.0)
|
71
68
|
rspec-core (~> 3.7.0)
|
@@ -86,7 +83,7 @@ GEM
|
|
86
83
|
terminal-table (1.8.0)
|
87
84
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
88
85
|
thread_safe (0.3.6)
|
89
|
-
tzinfo (1.2.
|
86
|
+
tzinfo (1.2.7)
|
90
87
|
thread_safe (~> 0.1)
|
91
88
|
unicode-display_width (1.7.0)
|
92
89
|
|
@@ -99,7 +96,6 @@ DEPENDENCIES
|
|
99
96
|
icalendar
|
100
97
|
jekyll
|
101
98
|
nokogiri
|
102
|
-
pry
|
103
99
|
rspec
|
104
100
|
|
105
101
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -43,14 +43,21 @@ plugins:
|
|
43
43
|
|
44
44
|
## Event Attributes:
|
45
45
|
|
46
|
+
All RFC 5545 properties are supported, examples:
|
47
|
+
|
48
|
+
- `dtstart` - start time of event
|
49
|
+
- `dtend` - end time of event
|
46
50
|
- `summary` - Title or name of event
|
47
51
|
- `description` - Notes/description of event
|
48
|
-
- `simple_html_description` - Notes/description of event with urls auto-linked
|
49
52
|
- `location` - Location of event
|
50
|
-
- `start_time` - start time of event
|
51
|
-
- `end_time` - end time of event
|
52
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
|
+
|
53
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
|
54
61
|
|
55
62
|
# Special Thanks
|
56
63
|
|
data/jekyll-ical-tag.gemspec
CHANGED
@@ -34,7 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency "api_cache"
|
35
35
|
spec.add_dependency "activesupport"
|
36
36
|
spec.add_dependency "icalendar"
|
37
|
-
spec.add_dependency "pry"
|
38
37
|
|
39
38
|
spec.add_development_dependency "bundler", "~> 1.15"
|
40
39
|
spec.add_development_dependency "rspec", "~> 3.5"
|
data/lib/jekyll-ical-tag.rb
CHANGED
@@ -30,35 +30,61 @@ module Jekyll
|
|
30
30
|
|
31
31
|
result = []
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
context.stack do
|
34
|
+
url = get_dereferenced_url(context) ||
|
35
|
+
@url
|
35
36
|
|
36
|
-
|
37
|
+
raise "No URL provided or in innapropriate form '#{url}'" unless is_valid_url?(url)
|
37
38
|
|
38
|
-
|
39
|
-
parser = CalendarLimiter.new(parser, only: @only)
|
40
|
-
parser = CalendarLimiter.new(parser, reverse: @reverse)
|
41
|
-
parser = CalendarLimiter.new(parser, before_date: @before_date)
|
42
|
-
parser = CalendarLimiter.new(parser, after_date: @after_date)
|
43
|
-
parser = CalendarLimiter.new(parser, limit: @limit)
|
39
|
+
puts "Fetching #{url}"
|
44
40
|
|
45
|
-
|
46
|
-
|
41
|
+
parser = CalendarParser.new(url)
|
42
|
+
parser = CalendarLimiter.new(parser, only: @only)
|
43
|
+
parser = CalendarLimiter.new(parser, reverse: @reverse)
|
44
|
+
parser = CalendarLimiter.new(parser, before_date: @before_date)
|
45
|
+
parser = CalendarLimiter.new(parser, after_date: @after_date)
|
46
|
+
parser = CalendarLimiter.new(parser, limit: @limit)
|
47
|
+
|
48
|
+
events = parser.events
|
49
|
+
length = events.length
|
47
50
|
|
48
|
-
context.stack do
|
49
51
|
events.each_with_index do |event, index|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
52
|
+
# Init
|
53
|
+
context["event"] = {}
|
54
|
+
|
55
|
+
# Jekyll helper variables
|
56
|
+
context["event"]["index"] = index
|
57
|
+
|
58
|
+
# RFC 5545 conformant and custom properties.
|
59
|
+
context["event"].merge!(event.all_properties)
|
60
|
+
|
61
|
+
# Supported but non-standard attributes.
|
62
|
+
context["event"]["attendees"] = event.attendees
|
63
|
+
context["event"]["simple_html_description"] = event.simple_html_description
|
64
|
+
|
65
|
+
# Overridden values
|
66
|
+
context["event"]["url"] ||= event.description_urls.first
|
67
|
+
|
68
|
+
# Deprecated attribute names.
|
69
|
+
context["event"]["end_time"] = context["event"]["dtend"]
|
70
|
+
context["event"]["start_time"] = context["event"]["dtstart"]
|
71
|
+
|
72
|
+
# Ensure all event values are utf8 encoded strings
|
73
|
+
# Ensure times (from dates)
|
74
|
+
# Ensure present
|
75
|
+
context["event"].transform_values! do |value|
|
76
|
+
v = case value
|
77
|
+
when String, Icalendar::Values::Text
|
78
|
+
value.force_encoding("UTF-8")
|
79
|
+
when Date, Icalendar::Values::DateTime
|
80
|
+
value.to_time
|
81
|
+
when Icalendar::Values::Uri
|
82
|
+
value.to_s
|
83
|
+
else
|
84
|
+
value
|
85
|
+
end
|
86
|
+
v.presence
|
87
|
+
end
|
62
88
|
|
63
89
|
context["forloop"] = {
|
64
90
|
"name" => "ical",
|
@@ -86,34 +112,14 @@ module Jekyll
|
|
86
112
|
|
87
113
|
private
|
88
114
|
|
89
|
-
def
|
90
|
-
!!(
|
91
|
-
end
|
92
|
-
|
93
|
-
def set_url_from_page_attributes!(context)
|
94
|
-
return if has_valid_url?
|
95
|
-
|
96
|
-
# Dereference @url from something like "page.calender_url" to the page's calendar_url
|
97
|
-
|
98
|
-
dig_attrs = @url.split(".")
|
99
|
-
dig_attrs[0] = dig_attrs[0].to_sym if dig_attrs[0].present?
|
100
|
-
if dug_result = context.registers.dig(*dig_attrs)
|
101
|
-
@url = dug_result
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def set_url_from_assigned_value!(context)
|
106
|
-
return if has_valid_url?
|
107
|
-
return unless context.scopes.first[@url]
|
108
|
-
|
109
|
-
# Dereference the URL if we were passed a variable name.
|
110
|
-
@url = context.scopes.first[@url]
|
115
|
+
def is_valid_url?(url)
|
116
|
+
!!(url =~ URI::regexp)
|
111
117
|
end
|
112
118
|
|
113
|
-
def
|
114
|
-
return unless
|
119
|
+
def get_dereferenced_url(context)
|
120
|
+
return unless context.key?(@url)
|
115
121
|
|
116
|
-
|
122
|
+
context[@url]
|
117
123
|
end
|
118
124
|
|
119
125
|
def scan_attributes!
|
@@ -6,20 +6,56 @@ require "uri"
|
|
6
6
|
module Jekyll
|
7
7
|
class IcalTag
|
8
8
|
class Event
|
9
|
-
URL_REGEX = /
|
9
|
+
URL_REGEX = /
|
10
|
+
(?:(?:https?|ftp):\/\/) # Allowable schemes
|
11
|
+
(?:\S+(?::\S*)?@)? # username:password, which is optional
|
12
|
+
(?: # Domain part follows; non-capturing
|
13
|
+
# These IP addresses are valid domain values
|
14
|
+
(?!10(?:\.\d{1,3}){3})
|
15
|
+
(?!127(?:\.\d{1,3}){3})
|
16
|
+
(?!169\.254(?:\.\d{1,3}){2})
|
17
|
+
(?!192\.168(?:\.\d{1,3}){2})
|
18
|
+
(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})
|
19
|
+
(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])
|
20
|
+
(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}
|
21
|
+
(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))
|
22
|
+
|
|
23
|
+
(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)
|
24
|
+
(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*
|
25
|
+
(?:\.(?:[a-z\u00a1-\uffff]{2,}))
|
26
|
+
)
|
27
|
+
(?::\d{2,5})? # Optional port number
|
28
|
+
(?:\/[^\s"]*)? # Anything that is not a space or a double quote
|
29
|
+
/x
|
10
30
|
extend Forwardable
|
11
31
|
|
12
32
|
def initialize(event)
|
13
33
|
@event = event
|
14
34
|
end
|
15
35
|
|
16
|
-
def_delegators :event, :
|
36
|
+
def_delegators :event, :dtstart, :dtend
|
37
|
+
|
38
|
+
def all_properties
|
39
|
+
@props ||= begin
|
40
|
+
props = {}
|
41
|
+
|
42
|
+
# RFC 5545 Properties
|
43
|
+
event.class.properties.each do |property|
|
44
|
+
props[property] = event.property(property)
|
45
|
+
end
|
46
|
+
|
47
|
+
# custom properties
|
48
|
+
props = props.merge(event.custom_properties)
|
49
|
+
|
50
|
+
props
|
51
|
+
end
|
52
|
+
end
|
17
53
|
|
18
54
|
def simple_html_description
|
19
55
|
@simple_html_description ||= begin
|
20
56
|
description&.clone.tap do |d|
|
21
57
|
description_urls.each do |url|
|
22
|
-
d.gsub! url, %(<a href='#{url}'>#{url}</a>)
|
58
|
+
d.force_encoding("UTF-8").gsub! url, %(<a href='#{url}'>#{url}</a>)
|
23
59
|
end
|
24
60
|
end
|
25
61
|
end
|
@@ -30,11 +66,12 @@ module Jekyll
|
|
30
66
|
end
|
31
67
|
|
32
68
|
def description_urls
|
33
|
-
@description_urls ||= description.to_s.scan(URL_REGEX).to_a
|
69
|
+
@description_urls ||= description.to_s.force_encoding("UTF-8").scan(URL_REGEX).to_a
|
34
70
|
end
|
35
71
|
|
36
72
|
private
|
37
73
|
|
74
|
+
def_delegators :event, :description, :attendee
|
38
75
|
attr_reader :event
|
39
76
|
end
|
40
77
|
end
|
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.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricky Chilcott
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry
|
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'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: bundler
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +94,7 @@ dependencies:
|
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '3.5'
|
111
|
-
description:
|
97
|
+
description:
|
112
98
|
email:
|
113
99
|
- ricky@rakefire.io
|
114
100
|
executables: []
|
@@ -132,7 +118,7 @@ licenses:
|
|
132
118
|
- MIT
|
133
119
|
metadata:
|
134
120
|
allowed_push_host: https://rubygems.org
|
135
|
-
post_install_message:
|
121
|
+
post_install_message:
|
136
122
|
rdoc_options: []
|
137
123
|
require_paths:
|
138
124
|
- lib
|
@@ -148,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
134
|
version: '0'
|
149
135
|
requirements: []
|
150
136
|
rubygems_version: 3.1.2
|
151
|
-
signing_key:
|
137
|
+
signing_key:
|
152
138
|
specification_version: 4
|
153
139
|
summary: A Jekyll plugin to pull ICS feed and provide a for-like loop of calendar
|
154
140
|
events
|