Skip to content

Commit

Permalink
fix: ics description length
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperDramsch committed Nov 12, 2024
1 parent eb504c7 commit 56bee3f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
3 changes: 2 additions & 1 deletion _layouts/calendar-conferences.ics
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ORGANIZER:pythondeadlin.es
DTSTAMP:{{ site.time | date: "%Y%m%dT%H%M%SZ" }}
DTSTART;VALUE=DATE:{{ conf.start | date: "%Y%m%d"}}
DTEND;VALUE=DATE:{{ conf.end | date: "%Y%m%d"}}
DESCRIPTION:<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.
{%- capture desc -%}<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.{%- endcapture -%}
{{ desc | prepend: "DESCRIPTION:" | normalize_whitespace | wrap_lines }}
LOCATION:{{ conf.place }}
ORGANIZER:pythondeadlin.es
END:VEVENT{% endfor %}
Expand Down
14 changes: 8 additions & 6 deletions _layouts/calendar-deadlines.ics
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ VERSION:2.0
PRODID:-//{{ site.url }}//{{ site.github_repo }}//EN
X-PUBLISHED-TTL:PT1H{% for conf in site.data.conferences %}
{%- if conf.cfp_ext -%}{%- assign cfp = conf.cfp_ext -%}{%- assign extended = "(extended)" -%}{%- else -%}{%- assign cfp = conf.cfp -%}{%- endif -%}
{%- capture desc -%}<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.{%- endcapture -%}
{% if conf.workshop_deadline and conf.workshop_deadline != "TBA" %}
BEGIN:VEVENT
SUMMARY:{{ conf.conference }} {{ conf.year }} Workshop Deadline
UID:{{conf.conference | slugify: "latin"}}-{{conf.year}}-workshop {%- if conf.timezone contains "UTC" -%} {%- assign tz = conf.timezone | split: "UTC" -%} {%- if tz[1] contains "-" -%} {%- assign tz = tz[1] | replace: "-", "+" -%} {%- else if tz[1] contains "+" -%} {%- assign tz = tz[1] | replace: "+", "-" -%} {%- else assign tz = tz[1] -%} {%- endif -%}
ORGANIZER:pythondeadlin.es
DESCRIPTION:<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.
{%- capture desc -%}<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.{%- endcapture -%}
{{ desc | prepend: "DESCRIPTION:" | normalize_whitespace | wrap_lines }}
DTSTAMP:{{ site.time | date: "%Y%m%dT%H%M%SZ" }}
DTSTART;TZID=Etc/GMT{{ tz }}:{{ conf.workshop_deadline | date: "%Y%m%dT%H%M%S" }}
{% else %}
ORGANIZER:pythondeadlin.es
DESCRIPTION:<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.
{{ desc | prepend: "DESCRIPTION:" | normalize_whitespace | wrap_lines }}
DTSTAMP:{{ site.time | date: "%Y%m%dT%H%M%SZ" }}
DTSTART;TZID={{ conf.timezone }}:{{ conf.workshop_deadline | date: "%Y%m%dT%H%M%S" }}
{% endif %}END:VEVENT
Expand All @@ -24,12 +26,12 @@ BEGIN:VEVENT
SUMMARY:{{ conf.conference }} {{ conf.year }} Tutorial Deadline
UID:{{conf.conference | slugify: "latin"}}-{{conf.year}}-tutorial {%- if conf.timezone contains "UTC" -%} {%- assign tz = conf.timezone | split: "UTC" -%} {%- if tz[1] contains "-" -%} {%- assign tz = tz[1] | replace: "-", "+" -%} {%- else if tz[1] contains "+" -%} {%- assign tz = tz[1] | replace: "+", "-" -%} {%- else assign tz = tz[1] -%} {%- endif -%}
ORGANIZER:pythondeadlin.es
DESCRIPTION:<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.
{{ desc | prepend: "DESCRIPTION:" | normalize_whitespace | wrap_lines }}
DTSTAMP:{{ site.time | date: "%Y%m%dT%H%M%SZ" }}
DTSTART;TZID=Etc/GMT{{ tz }}:{{ conf.tutorial_deadline | date: "%Y%m%dT%H%M%S" }}
{% else %}
ORGANIZER:pythondeadlin.es
DESCRIPTION:<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.
{{ desc | prepend: "DESCRIPTION:" | normalize_whitespace | wrap_lines }}
DTSTAMP:{{ site.time | date: "%Y%m%dT%H%M%SZ" }}
DTSTART;TZID={{ conf.timezone }}:{{ conf.tutorial_deadline | date: "%Y%m%dT%H%M%S" }}
{% endif %}END:VEVENT
Expand All @@ -39,12 +41,12 @@ BEGIN:VEVENT
SUMMARY:{{ conf.conference }} {{ conf.year }} Deadline {{ extended }}
UID:{{conf.conference | slugify: "latin"}}-{{conf.year}} {%- if conf.timezone contains "UTC" -%} {%- assign tz = conf.timezone | split: "UTC" -%} {%- if tz[1] contains "-" -%} {%- assign tz = tz[1] | replace: "-", "+" -%} {%- else if tz[1] contains "+" -%} {%- assign tz = tz[1] | replace: "+", "-" -%} {%- else assign tz = tz[1] -%} {%- endif -%}
ORGANIZER:pythondeadlin.es
DESCRIPTION:<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.
{{ desc | prepend: "DESCRIPTION:" | normalize_whitespace | wrap_lines }}
DTSTAMP:{{ site.time | date: "%Y%m%dT%H%M%SZ" }}
DTSTART;TZID=Etc/GMT{{ tz }}:{{ cfp | date: "%Y%m%dT%H%M%S" }}
{% else %}
ORGANIZER:pythondeadlin.es
DESCRIPTION:<a href="{{conf.link}}">{{ conf.conference }} {{ conf.year }}</a> found on <a href="https://pythondeadlin.es">PythonDeadlin.es</a>.
{{ desc | prepend: "DESCRIPTION:" | normalize_whitespace | wrap_lines }}
DTSTAMP:{{ site.time | date: "%Y%m%dT%H%M%SZ" }}
DTSTART;TZID={{ conf.timezone }}:{{ cfp | date: "%Y%m%dT%H%M%S" }}
{% endif %}END:VEVENT
Expand Down
21 changes: 21 additions & 0 deletions _plugins/jekyll-ics-wrap-lines-filter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Jekyll
module WrapLinesFilter
def wrap_lines(input_string)
max_length = 72
wrapped_string = ""

while input_string.length > max_length
line = input_string.slice!(0, max_length)
line += "\r\n "
wrapped_string += line
end

wrapped_string += input_string

wrapped_string

end
end
end

Liquid::Template.register_filter(Jekyll::WrapLinesFilter)

0 comments on commit 56bee3f

Please sign in to comment.