From 7b7af0423813918ccda28f12022892386b965d6f Mon Sep 17 00:00:00 2001 From: fpi Date: Tue, 17 Sep 2024 20:25:32 +0200 Subject: Cleanup description \n escape --- README.org | 2 +- gnus-icalendar-request.el | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/README.org b/README.org index 050d1f2..6cebc33 100644 --- a/README.org +++ b/README.org @@ -15,7 +15,7 @@ Extension of gnus-icalendar to format icalendar event requests based on [[https: - [ ] Updating event time :: ** Code TODOs -- [ ] Cleanup description creation +- [X] Cleanup description creation - [ ] Check attendee capturing from email ~From~ header. - [ ] Based on insertion method remove the multipart section or switch ~multipart/alternative~ if ~text/plain~ contains the same data as the ~text/calendar~ part. - [ ] Split default attendee line format into a ~defvar~ in ~gnus-icalendar--format-attendee~. diff --git a/gnus-icalendar-request.el b/gnus-icalendar-request.el index 95256bd..4711be1 100644 --- a/gnus-icalendar-request.el +++ b/gnus-icalendar-request.el @@ -51,16 +51,12 @@ role." (with-slots (summary description location organizer recur uid start-time end-time req-participants opt-participants) event (let ((dtstamp (format-time-string "DTSTAMP:%Y%m%dT%H%M%SZ" nil t)) ;; current UTC time (summary (format "SUMMARY:%s" summary)) - (description (when (and (stringp description) (not (string-empty-p description))) + (description (when (and (stringp description) + (not (string-empty-p description))) (format "DESCRIPTION:%s" - (with-temp-buffer - (insert description) - (beginning-of-buffer) - (while (re-search-forward "\n" nil t) - (replace-match "\\n" t t)) - (buffer-string))))) ;; TODO: How to do this properly? - (dtstart (format-time-string "DTSTART:%Y%m%dT%H%M%SZ" start-time t)) ;; start-time in UTC - (dtend (format-time-string "DTEND:%Y%m%dT%H%M%SZ" end-time t)) ;; end-time in UTC + (string-replace "\n" "\\n" description)))) + (dtstart (format-time-string "DTSTART:%Y%m%dT%H%M%SZ" start-time t)) ;; in UTC -> suffix "Z" + (dtend (format-time-string "DTEND:%Y%m%dT%H%M%SZ" end-time t)) (attendee (gnus-icalendar--create-attendee-list req-participants opt-participants)) (location (when (and (stringp location) (not (string-empty-p location))) (format "LOCATION:%s" location))) -- cgit v1.2.3