Skip to content

Commit

Permalink
Day 2 of trying to fix pdf bold / italics
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrillkuettel committed Nov 9, 2024
1 parent 4e59acc commit f33ad4b
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 25 deletions.
26 changes: 20 additions & 6 deletions src/privatim/reporting/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path

from babel.dates import format_datetime
from markupsafe import Markup

from privatim.i18n import translate, _
from privatim.layouts.layout import DEFAULT_TIMEZONE
Expand Down Expand Up @@ -129,15 +130,28 @@ def render_template(
) -> str:
"""Render chameleon report template."""
document_context = {'title': meeting.name, 'created_at': timestamp}
title = translate(
_(
"Protocol of meeting ${title}",
mapping={'title': document_context['title']},

agenda_items = []
for indx, item in enumerate(meeting.agenda_items, start=1):
agenda_items.append({
'title': Markup(
'<strong>{}.</strong> {}'.format(
indx, Markup.escape(item.title)
)
),
'description': Markup(item.description),
}
)
)

ctx = {
'title': title,
'title': translate(
_(
"Protocol of meeting ${title}",
mapping={'title': document_context['title']},
)
),
'meeting': meeting,
'agenda_items': agenda_items,
'sorted_attendance_records': meeting.attendance_records,
'meeting_time': datetime_format(meeting.time),
'document': document_context,
Expand Down
Loading

0 comments on commit f33ad4b

Please sign in to comment.