From 61e0ed226cb26426e82a61b00e05410bbd465f3f Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Thu, 14 Sep 2017 02:46:13 +0200 Subject: [PATCH] linebreaks --- cfp/templates/cfp/planning.ics | 2 +- cfp/views.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cfp/templates/cfp/planning.ics b/cfp/templates/cfp/planning.ics index d64ca90..931ce9a 100644 --- a/cfp/templates/cfp/planning.ics +++ b/cfp/templates/cfp/planning.ics @@ -13,7 +13,7 @@ DTEND:{{ talk.dtend }} SUMMARY:{{ talk.title }} LOCATION:{{ talk.room }} STATUS:{% if talk.accepted %}CONFIRMED{% else %}TENTATIVE{% endif %} -DESCRIPTION:{{ talk.description }} +DESCRIPTION:{{ talk.description|linebreaksbr }} UID:{{ site.domain }}/{{ talk.id }} END:VEVENT{% endfor %} END:VCALENDAR diff --git a/cfp/views.py b/cfp/views.py index bfaf9af..8fa9ecd 100644 --- a/cfp/views.py +++ b/cfp/views.py @@ -485,13 +485,13 @@ def schedule(request, program_format, pending, cache, template): response['Content-Disposition'] = 'attachment; filename="planning.ics"' ics = [] for line in program.render('ics').split('\n'): - line = line.strip() + line = line.strip().replace('
', '') if len(line) < 50: ics.append(line) else: # https://icalendar.org/iCalendar-RFC-5545/3-1-content-lines.html for i in range(ceil(len(line) / 50)): ics.append((' ' if i > 0 else '') + line[i * 50:(i + 1) * 50]) - response.write('\r\n'.join([line for line in ics if line])) + response.write('\r\n'.join([line for line in ics if line]).strip() + '\r\n') return response else: raise Http404(_("Format '%s' not available" % program_format))