diff --git a/src/static_site_generator.py b/src/static_site_generator.py index 38ee416..56bac63 100644 --- a/src/static_site_generator.py +++ b/src/static_site_generator.py @@ -1,28 +1,34 @@ from jinja2 import Environment, FileSystemLoader +import logging -# Example data -GENERATOR_DATA = { - 'title': 'Version Two', - 'github_user': 'octocat', - 'team': 'Platform Engineering', - 'tasks': [] -} -def generate_site(data=None, output_file='./_site/index.html'): - env = Environment(loader=FileSystemLoader('templates')) - template = env.get_template('kaban_board.html') +class StaticSiteGenerator(): - GENERATOR_DATA["tasks"] = data if data is not None else [] + def __init__(self): + self.GENERATOR_DATA = { + 'title': 'Version Two', + 'github_user': 'octocat', + 'team': 'Platform Engineering', + 'tasks': [] + } - # Extract unique statuses from the tasks list - unique_statuses = sorted({task["status"] for task in GENERATOR_DATA["tasks"]}) - - # Add statuses to the data dictionary - data_with_statuses = {**GENERATOR_DATA, "statuses": unique_statuses} - - # Render template with updated data - output = template.render(data_with_statuses) - - with open(output_file, 'w') as f: - f.write(output) + def generate_site(self, data=None, output_file='./_site/index.html'): + logging.info("Generating Static Site") + env = Environment(loader=FileSystemLoader('templates')) + template = env.get_template('kaban_board.html') + self.GENERATOR_DATA["tasks"] = data if data is not None else [] + + # Extract unique statuses from the tasks list + unique_statuses = sorted({task["status"] for task in self.GENERATOR_DATA["tasks"]}) + + # Add statuses to the data dictionary + data_with_statuses = {**self.GENERATOR_DATA, "statuses": unique_statuses} + + # Render template with updated data + output = template.render(data_with_statuses) + + with open(output_file, 'w') as f: + f.write(output) + + logging.info("Static Site Generated @ ./_site/index.html") diff --git a/templates/kaban_board.html b/templates/kaban_board.html index d55f0b3..2a7759c 100644 --- a/templates/kaban_board.html +++ b/templates/kaban_board.html @@ -41,88 +41,94 @@