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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 789ef2611f13b5cef3a81aa059cd0f414a5fe55ab741f875973e33d06519240a
4
- data.tar.gz: 4f9158d43cc9eeb7ab470b2847df479a73e4f439245678f5f9153b7ac4c48353
3
+ metadata.gz: 735242b817fc47985c9ba42dac9623eae14ca6a9b92ef51097321a562a520b63
4
+ data.tar.gz: 0b3b95d809779120ce76ad1748f431980566422385c3e817183c3b195828487b
5
5
  SHA512:
6
- metadata.gz: c4018b1bff230e0c5c280e2d06160cc3698f30641c436ce31dbb99f15bfe381748fad1cc42a3049c93941b245ca7df57149f5404c8fcd70f1290f9c8d56c43fa
7
- data.tar.gz: f410a0121363a5a4cb506ff9abbeef6bdeeee99fb641d7b0099d8029139a2b212b64c2cacee44e43653e9019fc63212bf694bef9d1a5c8ae7fd814342ccb7453
6
+ metadata.gz: 73ca22730936819071d80504c54a471b18cd17b6f8b0b1f4a35c79758ca7e1762b53c9d8b57637c6f2f7fc2552b5097e7a7bce6984aba849b3e3f286c3774bc4
7
+ data.tar.gz: c73793ded24a174c81ee7411a16b8e3a09e426ec208b388a9f905f6aa6457d57b8880c9df99650965ff0ce2c4deca254d6920543af95ab25075e5bc18dbce573
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- add_to_calendar (0.2.1)
4
+ add_to_calendar (0.2.2)
5
5
  tzinfo (>= 1.1, < 3)
6
6
  tzinfo-data (~> 1.2020)
7
7
 
@@ -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] = url_encode(description) if 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] << "\n\n#{url_encode(url)}"
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}=#{value}"
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
@@ -1,3 +1,3 @@
1
1
  module AddToCalendar
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: add_to_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Turner