jekyll-ical-tag 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_plugins/ical_tag.rb +28 -29
- data/bin/build-and-publish-gem +5 -0
- data/lib/jekyll-ical-tag/calendar_limiter.rb +1 -0
- data/lib/jekyll-ical-tag/calendar_parser.rb +2 -1
- data/lib/jekyll-ical-tag/event.rb +3 -2
- data/lib/jekyll-ical-tag/version.rb +1 -1
- data/lib/jekyll-ical-tag.rb +28 -27
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89414a4e5d53342a51bd18b90035331494b1a7d718dfcbe8705aa20a9e3d1e1d
|
4
|
+
data.tar.gz: 06157166f55b9e8b6b9264d39f2bb6619e610e19db0b5a039c61291a252ee296
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a00924f04b4e499e93aefa24a898c16c08ddbca5b700545cefad9709d2196dc96f4d3f38bd527cfb116952bafecbcfd54282baf1e01da30d51ccd265ae3b112d
|
7
|
+
data.tar.gz: fd81c2593db6517ca458560bce823778ec595765a0716d7365cade974d4e3204008aa3782903753d2ee1614ce5049708831cc924dbf0107650a049806114748a
|
data/_plugins/ical_tag.rb
CHANGED
@@ -89,30 +89,29 @@ module Jekyll
|
|
89
89
|
|
90
90
|
context.stack do
|
91
91
|
events.each_with_index do |event, index|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
'attendees' => attendees,
|
92
|
+
attendees = event.attendee.map(&:to_s).map { |a| a.slice!("mailto:"); a }
|
93
|
+
|
94
|
+
context["event"] = {
|
95
|
+
"index" => index,
|
96
|
+
"uid" => event.uid,
|
97
|
+
"summary" => event.summary,
|
98
|
+
"description" => event.description,
|
99
|
+
"location" => event.location,
|
100
|
+
"url" => event.url&.to_s,
|
101
|
+
"start_time" => event.dtstart&.to_time,
|
102
|
+
"end_time" => event.dtend&.to_time,
|
103
|
+
"attendees" => attendees,
|
105
104
|
}
|
106
105
|
|
107
|
-
context[
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
106
|
+
context["forloop"] = {
|
107
|
+
"name" => "calendar",
|
108
|
+
"length" => length,
|
109
|
+
"index" => index + 1,
|
110
|
+
"index0" => index,
|
111
|
+
"rindex" => length - index,
|
112
|
+
"rindex0" => length - index - 1,
|
113
|
+
"first" => (index == 0),
|
114
|
+
"last" => (index == length - 1),
|
116
115
|
}
|
117
116
|
|
118
117
|
result << nodelist.map do |n|
|
@@ -138,11 +137,11 @@ module Jekyll
|
|
138
137
|
end
|
139
138
|
|
140
139
|
def set_reverse!
|
141
|
-
@reverse = @attributes[
|
140
|
+
@reverse = @attributes["order"] == "reverse"
|
142
141
|
end
|
143
142
|
|
144
143
|
def set_url!
|
145
|
-
@url = @attributes[
|
144
|
+
@url = @attributes["url"]
|
146
145
|
raise "No URL provided" unless @url
|
147
146
|
end
|
148
147
|
|
@@ -165,8 +164,8 @@ module Jekyll
|
|
165
164
|
def set_before_date!
|
166
165
|
@before_date =
|
167
166
|
begin
|
168
|
-
if @attributes[
|
169
|
-
Time.parse(@attributes[
|
167
|
+
if @attributes["before_date"]
|
168
|
+
Time.parse(@attributes["before_date"])
|
170
169
|
end
|
171
170
|
rescue => e
|
172
171
|
nil
|
@@ -176,8 +175,8 @@ module Jekyll
|
|
176
175
|
def set_after_date!
|
177
176
|
@after_date =
|
178
177
|
begin
|
179
|
-
if @attributes[
|
180
|
-
Time.parse(@attributes[
|
178
|
+
if @attributes["after_date"]
|
179
|
+
Time.parse(@attributes["after_date"])
|
181
180
|
end
|
182
181
|
rescue => e
|
183
182
|
nil
|
@@ -186,4 +185,4 @@ module Jekyll
|
|
186
185
|
end
|
187
186
|
end
|
188
187
|
|
189
|
-
Liquid::Template.register_tag(
|
188
|
+
Liquid::Template.register_tag("ical", Jekyll::CalendarTag)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "api_cache"
|
@@ -15,7 +16,7 @@ module Jekyll
|
|
15
16
|
@events ||= begin
|
16
17
|
Icalendar::Event.parse(ics_feed)
|
17
18
|
.sort { |e1, e2| e1.dtstart <=> e2.dtstart }
|
18
|
-
.map{|e| Jekyll::IcalTag::Event.new(e) }
|
19
|
+
.map { |e| Jekyll::IcalTag::Event.new(e) }
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "uri"
|
@@ -25,11 +26,11 @@ module Jekyll
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def attendees
|
28
|
-
attendee.map(&:to_s).map {|a| a.slice!("mailto:"); a }
|
29
|
+
attendee.map(&:to_s).map { |a| a.slice!("mailto:"); a }
|
29
30
|
end
|
30
31
|
|
31
32
|
def description_urls
|
32
|
-
@description_urls ||= description.scan(URL_REGEX).to_a
|
33
|
+
@description_urls ||= description.to_s.force_encoding("UTF-8").scan(URL_REGEX).to_a
|
33
34
|
end
|
34
35
|
|
35
36
|
private
|
data/lib/jekyll-ical-tag.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "jekyll"
|
@@ -40,28 +41,28 @@ module Jekyll
|
|
40
41
|
|
41
42
|
context.stack do
|
42
43
|
events.each_with_index do |event, index|
|
43
|
-
context[
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
context["event"] = {
|
45
|
+
"index" => index,
|
46
|
+
"uid" => event.uid.presence,
|
47
|
+
"summary" => event.summary.presence,
|
48
|
+
"description" => event.description.presence,
|
49
|
+
"simple_html_description" => event.simple_html_description.presence,
|
50
|
+
"location" => event.location.presence,
|
51
|
+
"url" => event.url&.to_s.presence || event.description_urls.first,
|
52
|
+
"start_time" => event.dtstart&.to_time.presence,
|
53
|
+
"end_time" => event.dtend&.to_time.presence,
|
54
|
+
"attendees" => event.attendees,
|
54
55
|
}
|
55
56
|
|
56
|
-
context[
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
57
|
+
context["forloop"] = {
|
58
|
+
"name" => "ical",
|
59
|
+
"length" => length,
|
60
|
+
"index" => index + 1,
|
61
|
+
"index0" => index,
|
62
|
+
"rindex" => length - index,
|
63
|
+
"rindex0" => length - index - 1,
|
64
|
+
"first" => (index == 0),
|
65
|
+
"last" => (index == length - 1),
|
65
66
|
}
|
66
67
|
|
67
68
|
result << nodelist.map do |n|
|
@@ -87,11 +88,11 @@ module Jekyll
|
|
87
88
|
end
|
88
89
|
|
89
90
|
def set_reverse!
|
90
|
-
@reverse = @attributes[
|
91
|
+
@reverse = @attributes["order"] == "reverse"
|
91
92
|
end
|
92
93
|
|
93
94
|
def set_url!
|
94
|
-
@url = @attributes[
|
95
|
+
@url = @attributes["url"]
|
95
96
|
raise "No URL provided" unless @url
|
96
97
|
end
|
97
98
|
|
@@ -114,8 +115,8 @@ module Jekyll
|
|
114
115
|
def set_before_date!
|
115
116
|
@before_date =
|
116
117
|
begin
|
117
|
-
if @attributes[
|
118
|
-
Time.parse(@attributes[
|
118
|
+
if @attributes["before_date"]
|
119
|
+
Time.parse(@attributes["before_date"])
|
119
120
|
end
|
120
121
|
rescue => e
|
121
122
|
nil
|
@@ -125,8 +126,8 @@ module Jekyll
|
|
125
126
|
def set_after_date!
|
126
127
|
@after_date =
|
127
128
|
begin
|
128
|
-
if @attributes[
|
129
|
-
Time.parse(@attributes[
|
129
|
+
if @attributes["after_date"]
|
130
|
+
Time.parse(@attributes["after_date"])
|
130
131
|
end
|
131
132
|
rescue => e
|
132
133
|
nil
|
@@ -135,4 +136,4 @@ module Jekyll
|
|
135
136
|
end
|
136
137
|
end
|
137
138
|
|
138
|
-
Liquid::Template.register_tag(
|
139
|
+
Liquid::Template.register_tag("ical", Jekyll::IcalTag)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-ical-tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricky Chilcott
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- Gemfile.lock
|
121
121
|
- README.md
|
122
122
|
- _plugins/ical_tag.rb
|
123
|
+
- bin/build-and-publish-gem
|
123
124
|
- jekyll-ical-tag.gemspec
|
124
125
|
- lib/jekyll-ical-tag.rb
|
125
126
|
- lib/jekyll-ical-tag/calendar_limiter.rb
|