-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogramhtml.py
More file actions
36 lines (27 loc) · 912 Bytes
/
Copy pathprogramhtml.py
File metadata and controls
36 lines (27 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 08:49:33 2023
@author: repa
"""
from jinja2 import Environment, PackageLoader, \
Template
environment = Environment(
loader=PackageLoader("programhtml", 'templates')
)
class WriteHTML:
def __init__(self, project):
self.project = project
def authorList(self, template='authorlist.html'):
if isinstance(template, str):
gen = environment.get_template(template)
else:
gen = Template(template.read())
return gen.render(authors=self.project.author_list)
def eventList(self, template='eventlist.html'):
if isinstance(template, str):
gen = environment.get_template(template)
else:
gen = Template(template.read())
return gen.render(days=self.project.getDays(),
title=self.project.title)