add_to_calendar 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/add_to_calendar.rb +13 -3
- data/lib/add_to_calendar/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 735242b817fc47985c9ba42dac9623eae14ca6a9b92ef51097321a562a520b63
|
4
|
+
data.tar.gz: 0b3b95d809779120ce76ad1748f431980566422385c3e817183c3b195828487b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73ca22730936819071d80504c54a471b18cd17b6f8b0b1f4a35c79758ca7e1762b53c9d8b57637c6f2f7fc2552b5097e7a7bce6984aba849b3e3f286c3774bc4
|
7
|
+
data.tar.gz: c73793ded24a174c81ee7411a16b8e3a09e426ec208b388a9f905f6aa6457d57b8880c9df99650965ff0ce2c4deca254d6920543af95ab25075e5bc18dbce573
|
data/Gemfile.lock
CHANGED
data/lib/add_to_calendar.rb
CHANGED
@@ -107,10 +107,10 @@ module AddToCalendar
|
|
107
107
|
end
|
108
108
|
params[:SUMMARY] = url_encode(title)
|
109
109
|
params[:URL] = url_encode(url) if url
|
110
|
-
params[:DESCRIPTION] =
|
110
|
+
params[:DESCRIPTION] = url_encode_ical_description(description) if description
|
111
111
|
if add_url_to_description && url
|
112
112
|
if params[:DESCRIPTION]
|
113
|
-
params[:DESCRIPTION] << "
|
113
|
+
params[:DESCRIPTION] << "\\n\\n#{url_encode(url)}"
|
114
114
|
else
|
115
115
|
params[:DESCRIPTION] = url_encode(url)
|
116
116
|
end
|
@@ -121,7 +121,7 @@ module AddToCalendar
|
|
121
121
|
|
122
122
|
new_line = "%0A"
|
123
123
|
params.each do |key, value|
|
124
|
-
calendar_url << "#{new_line}#{key}
|
124
|
+
calendar_url << "#{new_line}#{key}:#{value}"
|
125
125
|
end
|
126
126
|
|
127
127
|
calendar_url << "%0AEND:VEVENT%0AEND:VCALENDAR"
|
@@ -238,5 +238,15 @@ module AddToCalendar
|
|
238
238
|
def newlines_to_html_br(string)
|
239
239
|
string.gsub(/(?:\n\r?|\r\n?)/, '<br>')
|
240
240
|
end
|
241
|
+
|
242
|
+
def url_encode_ical_description(description)
|
243
|
+
description.split("\n").map { |e|
|
244
|
+
if e == "\n"
|
245
|
+
"\\n"
|
246
|
+
else
|
247
|
+
url_encode(e) if e != "\n"
|
248
|
+
end
|
249
|
+
}.join("\\n")
|
250
|
+
end
|
241
251
|
end
|
242
252
|
end
|