Format test script, and strip whitespace

This commit is contained in:
c0de 2023-12-28 23:22:23 -06:00
parent 61dcf7caae
commit 25a3373f2b

73
test.py
View File

@ -21,83 +21,76 @@ template_vars = {
"bootstrap": { "bootstrap": {
"src": "./templates/example/bootstrap.bundle.min.js", "src": "./templates/example/bootstrap.bundle.min.js",
}, },
"theme": { "theme": {"src": ".templates/example/color-modes.js"},
"src": ".templates/example/color-modes.js"
}
}, },
"css": { "css": {
"bootstrap": { "bootstrap": {"src": "./templates/example/bootstrap.min.css"},
"src": "./templates/example/bootstrap.min.css" "theme": {"src": "./templates/example/gallery.css"},
},
"theme": {
"src": "./templates/example/gallery.css"
},
"icons": { "icons": {
"src": "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css" "src": "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css"
} },
} },
}, },
"meta_list": [ "meta_list": [
{ "name": "description", "content": "This is a description" }, {"name": "description", "content": "This is a description"},
{ "name": "generator", "content": "simple-s3-gallery v.2023.12" }, {"name": "generator", "content": "simple-s3-gallery v.2023.12"},
{ "name": "author", "content": "Code Fox" }, {"name": "author", "content": "Code Fox"},
{ "name": "theme-color", "content": "#712cf9" } {"name": "theme-color", "content": "#712cf9"},
], ],
"left_header": "About the gallery", "left_header": "About the gallery",
"left_text": "This is an example gallery that is generated via a template", "left_text": "This is an example gallery that is generated via a template",
"right_header": "Contact", "right_header": "Contact",
"link_list": [ "link_list": [
{ "href": "https://c0defox.es", "text": "Fox :3" }, {"href": "https://c0defox.es", "text": "Fox :3"},
{ "href": "https://furry.engineer/c0de", "text": "Mastodon", "icon": "mastodon" } {"href": "https://furry.engineer/c0de", "text": "Mastodon", "icon": "mastodon"},
], ],
"footer": { "footer": {
"main_line": "Copyright 2024 Code Fox", "main_line": "Copyright 2024 Code Fox",
"extra_lines": [ "extra_lines": ["This is another line", "This is yet another line"],
"This is another line",
"This is yet another line"
]
}, },
"active": False, "active": False,
"header": "This is a call to action", "header": "This is a call to action",
"lead_text": "Some interesting text for the user", "lead_text": "Some interesting text for the user",
"action_buttons": [ "action_buttons": [
{ "href": "1" }, {"href": "1"},
{ "href": "2", "theme": "danger" }, {"href": "2", "theme": "danger"},
{ "href": "3", "theme": "warning", "icon": "exclamation-diamond-fill" }, {"href": "3", "theme": "warning", "icon": "exclamation-diamond-fill"},
{ "href": "3", "theme": "warning", "icon": "exclamation-diamond-fill", "text": "some text" } {
"href": "3",
"theme": "warning",
"icon": "exclamation-diamond-fill",
"text": "some text",
},
], ],
"gallery_items": [ "gallery_items": [
{ {
"src": "https://files.c0defox.es/Pictures/arctic-fox.jpg", "src": "https://files.c0defox.es/Pictures/arctic-fox.jpg",
"description": "An arctic fox :3", "description": "An arctic fox :3",
"title": "fox", "title": "fox",
"reactions": [ "reactions": ["heart-fill", "backpack4", "balloon-fill", "bag-x-fill"],
"heart-fill",
"backpack4",
"balloon-fill",
"bag-x-fill"
],
}, },
{ {
"src": "https://files.c0defox.es/Pictures/arctic-fox.jpg", "src": "https://files.c0defox.es/Pictures/arctic-fox.jpg",
"description": "An arctic fox :3", "description": "An arctic fox :3",
"title": "fox", "title": "fox",
"reactions": [ "reactions": ["heart", "backpack3", "balloon", "bag-x"],
"heart", },
"backpack3", ],
"balloon",
"bag-x"
],
}
]
} }
def main(): def main():
"""main method""" """main method"""
env = Environment(loader=FileSystemLoader("templates"), autoescape=select_autoescape()) env = Environment(
loader=FileSystemLoader("templates"),
autoescape=select_autoescape(),
trim_blocks=True,
lstrip_blocks=True,
)
template = env.get_template("base.html") template = env.get_template("base.html")
print(template.render(**template_vars)) print(template.render(**template_vars))
if __name__ == "__main__": if __name__ == "__main__":
main() main()