-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
561 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
from datetime import datetime | ||
import yaml | ||
from jinja2 import Environment, FileSystemLoader | ||
import json | ||
|
||
|
||
def load_resources(): | ||
with open('resources.yaml', 'r') as file: | ||
return yaml.safe_load(file)['resources'] | ||
with open("resources.yaml", "r") as file: | ||
return yaml.safe_load(file)["resources"] | ||
|
||
|
||
def generate_html(resources): | ||
# Prepare Jinja2 environment | ||
env = Environment(loader=FileSystemLoader('.')) | ||
template = env.get_template('template.html') | ||
env = Environment(loader=FileSystemLoader(".")) | ||
template = env.get_template("template.html") | ||
|
||
# Render the template | ||
html_output = template.render( | ||
resources=resources, | ||
resources_json=json.dumps(resources) | ||
resources_json=json.dumps(resources), | ||
generation_date=datetime.now(), | ||
) | ||
|
||
# Write the output | ||
with open('dist/index.html', 'w') as file: | ||
with open("dist/index.html", "w") as file: | ||
file.write(html_output) | ||
|
||
|
||
def main(): | ||
import os | ||
import shutil | ||
os.makedirs('dist', exist_ok=True) | ||
|
||
os.makedirs("dist", exist_ok=True) | ||
resources = load_resources() | ||
generate_html(resources) | ||
# Copy the styles file to the dist directory | ||
shutil.copy('styles.css', 'dist/styles.css') | ||
shutil.copytree('scripts', 'dist/scripts/', dirs_exist_ok=True) | ||
shutil.copy("styles.css", "dist/styles.css") | ||
shutil.copytree("scripts", "dist/scripts/", dirs_exist_ok=True) | ||
shutil.copytree("logos", "dist/logos/", dirs_exist_ok=True) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
if __name__ == "__main__": | ||
main() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.