Skip to content

Commit

Permalink
Allow talks of one "program day" to spread over multiple actual days
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzschmid committed Mar 1, 2021
1 parent 7d5b828 commit 27295c8
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
jekyll-theme-conference (3.1.5)
jekyll-theme-conference (3.2.0)
jekyll (~> 4.0)

GEM
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ The order of the rooms in the list defines the order of the rooms as shown in th
Each talk consists of

- a `name` (must correspond to one of the talk identifier),
- a starting time `time_start` given as `H:M` ([`strftime`](http://www.strfti.me) formated), and
- a starting time `time_start` given as `H:M` ([`strftime`](http://www.strfti.me) formated) or `H:M +∆` whereby ∆ is the day offset in relation to the date given for the given day, and
- an end time `time_end`.

The list of talks should (manually) be ordered by time, i.e. the first occurring talk should be listed first.
Expand Down
6 changes: 4 additions & 2 deletions _includes/partials/get_day_time.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
{%- assign t = r.talks | first -%}
{%- include partials/get_talk_time.html -%}

{%- if forloop.index == 1 or talk_start_hour < day_start_hour or talk_start_hour == day_start_hour and talk_start_min < day_start_min-%}
{%- if forloop.index == 1 or talk_start_day < day_start_day or talk_start_day == day_start_day and talk_start_hour < day_start_hour or talk_start_hour == day_start_hour and talk_start_min < day_start_min-%}
{%- assign day_start_talk = t -%}
{%- assign day_start_day = talk_start_day -%}
{%- assign day_start_hour = talk_start_hour -%}
{%- assign day_start_min = talk_start_min -%}
{%- endif -%}

{%- assign t = r.talks | last -%}
{%- include partials/get_talk_time.html -%}

{%- if forloop.index == 1 or talk_end_hour > day_end_hour or talk_end_hour == day_end_hour and talk_end_min > day_end_min-%}
{%- if forloop.index == 1 or talk_end_day > day_end_day or talk_end_day == day_end_day and talk_end_hour > day_end_hour or talk_end_hour == day_end_hour and talk_end_min > day_end_min-%}
{%- assign day_end_talk = t -%}
{%- assign day_end_day = talk_end_day -%}
{%- assign day_end_hour = talk_end_hour -%}
{%- assign day_end_min = talk_end_min -%}
{%- endif -%}
Expand Down
21 changes: 18 additions & 3 deletions _includes/partials/get_talk_time.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
{%- assign talk_start = t.time_start -%}
{%- assign talk_end = t.time_end -%}

{%- assign talk_start_hour = talk_start | split: ':' | first -%}
{%- if talk_start contains ' +' -%}
{%- assign talk_start_day = talk_start | split: ' +' | last | plus: 0 -%}
{%- assign talk_start = talk_start | split: ' +' | first -%}
{%- else -%}
{%- assign talk_start_day = 0 -%}
{%- endif -%}
{%- if talk_end contains ' +' -%}
{%- assign talk_end_day = talk_end | split: ' +' | last | plus: 0 -%}
{%- assign talk_end = talk_end | split: ' +' | first -%}
{%- else -%}
{%- assign talk_end_day = 0 -%}
{%- endif -%}

{%- assign talk_start_hour = talk_start | split: ':' | first | plus: 0 -%}
{%- assign talk_start_min = talk_start | split: ':' | last | divided_by: site.conference.program.time_steps | floor | times: site.conference.program.time_steps -%}
{%- assign talk_end_hour = talk_end | split: ':' | first -%}
{%- assign talk_end_hour = talk_end | split: ':' | first | plus: 0 -%}
{%- assign talk_end_min = talk_end | split: ':' | last | divided_by: site.conference.program.time_steps | ceil | times: site.conference.program.time_steps -%}

{%- assign talk_duration_min = talk_end_hour | minus: talk_start_hour | times: 60 | minus: talk_start_min | plus: talk_end_min -%}
{%- assign talk_start_hour_24h = talk_start_day | times: 24 | plus: talk_start_hour -%}
{%- assign talk_end_hour_24h = talk_end_day | times: 24 | plus: talk_end_hour -%}
{%- assign talk_duration_min = talk_end_hour_24h | minus: talk_start_hour_24h | times: 60 | minus: talk_start_min | plus: talk_end_min -%}
13 changes: 9 additions & 4 deletions _includes/partials/get_talk_timestamp.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{%- assign datetime_start = d.date | append: " " | append: t.time_start -%}
{%- assign timestamp_start = datetime_start | date: "%s" -%}
{%- assign datetime_end = d.date | append: " " | append: t.time_end -%}
{%- assign timestamp_end = datetime_end | date: "%s" -%}
{%- include partials/get_talk_time.html -%}

{%- assign datetime_start = d.date | append: " " | append: time_start -%}
{%- assign add_days_start = talk_start_day | times: 24 | times: 60 | times: 60 -%}
{%- assign timestamp_start = datetime_start | date: "%s" | plus: add_days_start | date: "%s" -%}

{%- assign datetime_end = d.date | append: " " | append: time_end -%}
{%- assign add_days_end = talk_end_day | times: 24 | times: 60 | times: 60 -%}
{%- assign timestamp_end = datetime_end | date: "%s" | plus: add_days_end | date: "%s" -%}
19 changes: 14 additions & 5 deletions _layouts/program.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ <h1 class="display-5 {% if nbr_days > 1 -%} mb-2 {%- else -%} mb-4 {%- endif %}"
<tbody>
{%- include partials/get_day_time.html -%}

{%- if day_end_day > day_start_day -%}
{%- assign day_end_hour = day_end_day | minus: day_start_day | times: 24 | plus: day_end_hour -%}
{%- endif -%}

{%- assign day_duration_min = day_end_hour | minus: day_start_hour | times: 60 | minus: day_start_min | plus: day_end_min -%}
{%- assign nbr_steps = day_duration_min | divided_by: site.conference.program.time_steps -%}

Expand All @@ -74,7 +78,12 @@ <h1 class="display-5 {% if nbr_days > 1 -%} mb-2 {%- else -%} mb-4 {%- endif %}"
{%- assign z-index-max = 999 -%}

{%- for i in (1..nbr_steps) -%}
{%- assign current_hour = i | minus: 1 | times: site.conference.program.time_steps | plus: day_start_min | divided_by: 60 | floor | plus: day_start_hour | modulo: 24 -%}
{%- assign current_day = 0 -%}
{%- assign current_hour = i | minus: 1 | times: site.conference.program.time_steps | plus: day_start_min | divided_by: 60 | floor | plus: day_start_hour -%}
{%- if current_hour >= 24 -%}
{%- assign current_day = current_hour | divided_by: 24 | floor -%}
{%- assign current_hour = current_hour | modulo: 24 -%}
{%- endif -%}
{%- assign current_min = i | minus: 1 | times: site.conference.program.time_steps | plus: day_start_min | modulo: 60 -%}
{%- if current_min < 10 -%}
{%- assign current_time = current_hour | append: ':0' | append: current_min -%}
Expand Down Expand Up @@ -106,9 +115,9 @@ <h1 class="display-5 {% if nbr_days > 1 -%} mb-2 {%- else -%} mb-4 {%- endif %}"

{%- include partials/get_talk_time.html -%}

{%- assign d_start_hour = current_hour | minus: talk_start_hour -%}
{%- assign d_start_hour = current_day | minus: talk_start_day | times: 24 | plus: current_hour | minus: talk_start_hour -%}
{%- assign d_start_min = current_min | minus: talk_start_min -%}
{%- assign d_end_hour = current_hour | minus: talk_end_hour -%}
{%- assign d_end_hour = current_day | minus: talk_end_day | times: 24 | plus: current_hour | minus: talk_end_hour -%}
{%- assign d_end_min = current_min | minus: talk_end_min -%}

{%- assign has_started = false -%}
Expand All @@ -127,7 +136,7 @@ <h1 class="display-5 {% if nbr_days > 1 -%} mb-2 {%- else -%} mb-4 {%- endif %}"
{%- assign has_ended = true -%}
{%- endif -%}

{%- if has_started and has_ended == false -%}
{%- if has_started == true and has_ended == false -%}
{%- assign active_talk = true -%}
{%- endif -%}

Expand Down Expand Up @@ -156,7 +165,7 @@ <h1 class="display-5 {% if nbr_days > 1 -%} mb-2 {%- else -%} mb-4 {%- endif %}"

{%- endfor %}

{%- unless active_talk %}
{%- unless active_talk == true %}
<td class="p-0"></td>
{%- endunless -%}

Expand Down
17 changes: 12 additions & 5 deletions _tools/create_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def parse_frab(file_path):
content['speakers'][-1]['last_name'] = \
speaker_names[0]


abstract = talk['abstract']
description = talk['description']

Expand All @@ -133,11 +132,19 @@ def parse_frab(file_path):
# Calculate talk end time
talk_start = (talk['start']).split(':')
talk_duration = (talk['duration']).split(':')
talk_end = [int(talk_start[0]) + int(talk_duration[0]),

talk_end = [0,
int(talk_start[0]) + int(talk_duration[0]),
int(talk_start[1]) + int(talk_duration[1])]
talk_end[0] = (talk_end[0] + talk_end[1] // 60) % 24
talk_end[1] = talk_end[1] % 60
talk_end = "{}:{:02d}".format(talk_end[0], talk_end[1])
talk_end[1] = (talk_end[1] + talk_end[2] // 60)
talk_end[2] %= 60
talk_end[0] = (talk_end[0] + talk_end[1] // 24)
talk_end[1] %= 24

# Indicate if talk is overlapping into next day
talk_end = '{:02d}:{:02d}{}'.format(
talk_end[1], talk_end[2],
' +{}'.format(talk_end[0]) if talk_end[0] > 0 else '')

content['program'].append({
'name': talk['title'],
Expand Down
2 changes: 1 addition & 1 deletion jekyll-theme-conference.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "jekyll-theme-conference"
spec.version = "3.1.5"
spec.version = "3.2.0"
spec.authors = ["Lorenz Schmid"]
spec.email = ["lorenzschmid@users.noreply.github.com"]

Expand Down

0 comments on commit 27295c8

Please sign in to comment.