heroweb/lib/webcomponents/calendar/web.py

22 lines
595 B
Python
Raw Normal View History

2024-09-01 18:00:13 +00:00
from jinja2 import Environment, FileSystemLoader
import os
# Create an agenda instance
agenda = Agenda()
# Set up Jinja2 environment and load the template
env = Environment(loader=FileSystemLoader(searchpath="./templates"))
template = env.get_template('calendar.html')
# Render the template with the agenda data
output = template.render(
current_day=agenda.current_day,
current_year=agenda.current_year,
days_of_week=agenda.days_of_week,
calendar=agenda.calendar
)
# Save the rendered output or print it
with open('output_calendar.html', 'w') as file:
file.write(output)