Skip to content

Commit

Permalink
Add PDF schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Oct 21, 2024
1 parent d17b62c commit efdedf9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.venv:
python3 -m venv .venv
.venv/bin/pip install setuptools frozen-flask flask libsass markdown2 python-slugify babel
.venv/bin/pip install setuptools frozen-flask flask flask-weasyprint libsass markdown2 python-slugify babel

install: .venv

Expand Down
8 changes: 7 additions & 1 deletion pyconfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

from babel.dates import format_date, format_time, format_timedelta
from datetime import date, time, timedelta
from flask import Flask, Response, render_template
from flask import Flask, Response, render_template, url_for
from flask_frozen import Freezer
from flask_weasyprint import render_pdf
from markdown2 import Markdown
from sassutils.wsgi import SassMiddleware
from slugify import slugify
Expand Down Expand Up @@ -98,6 +99,11 @@ def schedule(lang):
schedule=SCHEDULE)


@app.route('/2024/<lang>/full-schedule.pdf')
def pdf_schedule(lang):
return render_pdf(url_for('schedule', lang=lang))


@app.route('/2024/<lang>/calendar.ics')
def calendar(lang):
ics = render_template('calendar.jinja2.ics', lang=lang, schedule=SCHEDULE)
Expand Down
54 changes: 54 additions & 0 deletions static/sass/style.sass
Original file line number Diff line number Diff line change
Expand Up @@ -910,3 +910,57 @@ main
float: none
margin: 0
width: 100%


// Print
@media print
@page
margin: 1.35cm 1.5cm
size: A4 landscape

#full-schedule
background: none

table
border-spacing: 0
font-size: 8pt

thead
height: auto
text-align: center
top: 0

th:not(:empty)
background: $purple

&.rooms
tr > :first-child::before
content: none

&.day
th
padding-bottom: 0
transform: translate(0 -4em)

tr:not(:last-child)
height: 6em

tr:has([href$="#talk-MRHUVD"]) + tr,
tr:has(#sunday-lunch) + tr
height: 0 !important

td
border-bottom: 1px solid $grey
border-top: 1px solid $grey
border-right: 1px solid $grey
line-height: 1.15
padding: 0.5em 0.5em 2.5em 0.5em

.extra div
background: none !important
color: inherit
height: 4em !important
justify-content: flex-start
padding-left: 0.25em
width: 100%
7 changes: 4 additions & 3 deletions templates/en/schedule.jinja2.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ <h3>Keynotes</h3>
<section id="calendar">
<h3>Calendar</h3>
<p>
The calendar is available below, in a
<a href="{{ url_for('schedule', lang=lang) }}">fullscreen page</a>, or
<a href="{{ url_for('calendar', lang=lang) }}">in your favourite calendar application</a>.
The calendar is available below,
in a <a href="{{ url_for('schedule', lang=lang) }}">fullscreen page</a>,
in <a href="{{ url_for('pdf_schedule', lang=lang) }}">PDF format</a>,
or in your <a href="{{ url_for('calendar', lang=lang) }}">favourite calendar application</a>.
</p>
<p>
You can read the description of
Expand Down
7 changes: 4 additions & 3 deletions templates/fr/schedule.jinja2.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ <h3>Keynotes</h3>
<section id="calendar">
<h3>Calendrier</h3>
<p>
Le calendrier est disponible ci-dessous, sur une
<a href="{{ url_for('schedule', lang=lang) }}">page en plein écran</a>,
ou <a href="{{ url_for('calendar', lang=lang) }}">dans votre application de calendrier favorite</a>.
Le calendrier est disponible ci-dessous,
sur une <a href="{{ url_for('schedule', lang=lang) }}">page en plein écran</a>,
en <a href="{{ url_for('pdf_schedule', lang=lang) }}">format PDF</a>,
ou dans votre <a href="{{ url_for('calendar', lang=lang) }}">application de calendrier favorite</a>.
</p>
<p>
Vous pouvez également lire la description des
Expand Down

0 comments on commit efdedf9

Please sign in to comment.