Skip to content

Commit efdedf9

Browse files
committed
Add PDF schedule
1 parent d17b62c commit efdedf9

File tree

5 files changed

+70
-8
lines changed

5 files changed

+70
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.venv:
22
python3 -m venv .venv
3-
.venv/bin/pip install setuptools frozen-flask flask libsass markdown2 python-slugify babel
3+
.venv/bin/pip install setuptools frozen-flask flask flask-weasyprint libsass markdown2 python-slugify babel
44

55
install: .venv
66

pyconfr.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
from babel.dates import format_date, format_time, format_timedelta
55
from datetime import date, time, timedelta
6-
from flask import Flask, Response, render_template
6+
from flask import Flask, Response, render_template, url_for
77
from flask_frozen import Freezer
8+
from flask_weasyprint import render_pdf
89
from markdown2 import Markdown
910
from sassutils.wsgi import SassMiddleware
1011
from slugify import slugify
@@ -98,6 +99,11 @@ def schedule(lang):
9899
schedule=SCHEDULE)
99100

100101

102+
@app.route('/2024/<lang>/full-schedule.pdf')
103+
def pdf_schedule(lang):
104+
return render_pdf(url_for('schedule', lang=lang))
105+
106+
101107
@app.route('/2024/<lang>/calendar.ics')
102108
def calendar(lang):
103109
ics = render_template('calendar.jinja2.ics', lang=lang, schedule=SCHEDULE)

static/sass/style.sass

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,3 +910,57 @@ main
910910
float: none
911911
margin: 0
912912
width: 100%
913+
914+
915+
// Print
916+
917+
@media print
918+
@page
919+
margin: 1.35cm 1.5cm
920+
size: A4 landscape
921+
922+
#full-schedule
923+
background: none
924+
925+
table
926+
border-spacing: 0
927+
font-size: 8pt
928+
929+
thead
930+
height: auto
931+
text-align: center
932+
top: 0
933+
934+
th:not(:empty)
935+
background: $purple
936+
937+
&.rooms
938+
tr > :first-child::before
939+
content: none
940+
941+
&.day
942+
th
943+
padding-bottom: 0
944+
transform: translate(0 -4em)
945+
946+
tr:not(:last-child)
947+
height: 6em
948+
949+
tr:has([href$="#talk-MRHUVD"]) + tr,
950+
tr:has(#sunday-lunch) + tr
951+
height: 0 !important
952+
953+
td
954+
border-bottom: 1px solid $grey
955+
border-top: 1px solid $grey
956+
border-right: 1px solid $grey
957+
line-height: 1.15
958+
padding: 0.5em 0.5em 2.5em 0.5em
959+
960+
.extra div
961+
background: none !important
962+
color: inherit
963+
height: 4em !important
964+
justify-content: flex-start
965+
padding-left: 0.25em
966+
width: 100%

templates/en/schedule.jinja2.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ <h3>Keynotes</h3>
7070
<section id="calendar">
7171
<h3>Calendar</h3>
7272
<p>
73-
The calendar is available below, in a
74-
<a href="{{ url_for('schedule', lang=lang) }}">fullscreen page</a>, or
75-
<a href="{{ url_for('calendar', lang=lang) }}">in your favourite calendar application</a>.
73+
The calendar is available below,
74+
in a <a href="{{ url_for('schedule', lang=lang) }}">fullscreen page</a>,
75+
in <a href="{{ url_for('pdf_schedule', lang=lang) }}">PDF format</a>,
76+
or in your <a href="{{ url_for('calendar', lang=lang) }}">favourite calendar application</a>.
7677
</p>
7778
<p>
7879
You can read the description of

templates/fr/schedule.jinja2.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ <h3>Keynotes</h3>
6969
<section id="calendar">
7070
<h3>Calendrier</h3>
7171
<p>
72-
Le calendrier est disponible ci-dessous, sur une
73-
<a href="{{ url_for('schedule', lang=lang) }}">page en plein écran</a>,
74-
ou <a href="{{ url_for('calendar', lang=lang) }}">dans votre application de calendrier favorite</a>.
72+
Le calendrier est disponible ci-dessous,
73+
sur une <a href="{{ url_for('schedule', lang=lang) }}">page en plein écran</a>,
74+
en <a href="{{ url_for('pdf_schedule', lang=lang) }}">format PDF</a>,
75+
ou dans votre <a href="{{ url_for('calendar', lang=lang) }}">application de calendrier favorite</a>.
7576
</p>
7677
<p>
7778
Vous pouvez également lire la description des

0 commit comments

Comments
 (0)