Skip to content

Commit 6ada6fb

Browse files
escowlesphette23
authored andcommitted
Using {%- -%} to remove extra blank lines in ICS files
1 parent 4af16fc commit 6ada6fb

2 files changed

Lines changed: 29 additions & 29 deletions

File tree

_includes/calendar-day.ics

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
{% for event in include.events %}
2-
{% assign times = event.time | remove: ":" | split: "-" %}
3-
{% if times[0] and times[1] %}
1+
{%- for event in include.events -%}
2+
{%- assign times = event.time | remove: ":" | split: "-" -%}
3+
{%- if times[0] and times[1] %}
44
BEGIN:VEVENT
55
SUMMARY:{{ event.title }} (Code4Lib {{ site.data.conf.year }})
6-
{% if event.groupId %}
7-
{% assign talks = site.posts | where: "group", event.groupId | sort: "spot" %}
6+
{% if event.groupId -%}
7+
{%- assign talks = site.posts | where: "group", event.groupId | sort: "spot" -%}
88
{%- capture desc -%}
9-
{% unless event.groupId == 'key-open' or event.groupId == 'key-close' %}
9+
{%- unless event.groupId == 'key-open' or event.groupId == 'key-close' -%}
1010
{{ event.title }} ({{talks | size}} talks):
11-
{% endunless %}
11+
{%- endunless -%}
1212
{%- endcapture -%}
1313
DESCRIPTION: {{ desc | strip }}\n\n
14-
{% for talk in talks %}
14+
{%- for talk in talks -%}
1515
{{ talk.speaker-text }}\n
1616
{{ talk.title }} ({{ talk.length }} minutes)\n
1717
{{ talk.url | absolute_url }}\n\n
18-
{% endfor %}
19-
{% endif %}
20-
{% if event.link %}
18+
{%- endfor -%}
19+
{%- endif -%}
20+
{%- if event.link -%}
2121
DESCRIPTION: {{event.button_label}}\n {{event.link}}
22-
{% endif %}
22+
{%- endif %}
2323
DTSTART;TZID=America/New_York:{{include.date}}T{{times[0]}}00
2424
DTEND;TZID=America/New_York:{{include.date}}T{{times[1]}}00
25-
{% comment %}LOCATION:http://example.org/TODO{% endcomment %}
25+
{%- comment %}LOCATION:http://example.org/TODO{%- endcomment %}
2626
END:VEVENT
27-
{% endif %}
28-
{% endfor %}
27+
{% endif -%}
28+
{%- endfor -%}

_includes/calendar.ics

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
BEGIN:VCALENDAR
22
CALSCALE:GREGORIAN
33
VERSION:2.0
4-
{% if include.livestream %}
5-
{% assign ver = "livestream" %}
6-
{% else %}
7-
{% assign ver = "in-person" %}
8-
{% endif %}
4+
{% if include.livestream -%}
5+
{%- assign ver = "livestream" -%}
6+
{%- else -%}
7+
{%- assign ver = "in-person" -%}
8+
{%- endif -%}
99
X-WR-CALNAME:Code4Lib {{ site.data.conf.year }} {{ ver }}
10-
{% assign day1_date = site.data.conf.days[1].date-data | date: "%Y%m%d" %}
11-
{% assign day1_events = site.data.schedule | where: "day1", true | where: "livestream", include.livestream %}
12-
{% include calendar-day.ics date=day1_date events=day1_events %}
10+
{%- assign day1_date = site.data.conf.days[1].date-data | date: "%Y%m%d" -%}
11+
{%- assign day1_events = site.data.schedule | where: "day1", true | where: "livestream", include.livestream -%}
12+
{%- include calendar-day.ics date=day1_date events=day1_events -%}
1313

14-
{% assign day2_date = site.data.conf.days[2].date-data | date: "%Y%m%d" %}
15-
{% assign day2_events = site.data.schedule | where: "day2", true | where: "livestream", include.livestream %}
16-
{% include calendar-day.ics date=day2_date events=day2_events %}
14+
{%- assign day2_date = site.data.conf.days[2].date-data | date: "%Y%m%d" -%}
15+
{%- assign day2_events = site.data.schedule | where: "day2", true | where: "livestream", include.livestream -%}
16+
{%- include calendar-day.ics date=day2_date events=day2_events -%}
1717

18-
{% assign day3_date = site.data.conf.days[3].date-data | date: "%Y%m%d" %}
19-
{% assign day3_events = site.data.schedule | where: "day3", true | where: "livestream", include.livestream %}
20-
{% include calendar-day.ics date=day3_date events=day3_events %}
18+
{%- assign day3_date = site.data.conf.days[3].date-data | date: "%Y%m%d" -%}
19+
{%- assign day3_events = site.data.schedule | where: "day3", true | where: "livestream", include.livestream -%}
20+
{%- include calendar-day.ics date=day3_date events=day3_events -%}
2121
END:VCALENDAR

0 commit comments

Comments
 (0)