Compare commits

..

No commits in common. "4cabbe2013e438a88fa011d05c3ca9b3b8c5f71d" and "61dcf7caae19ee0c20d6d3c4a922dfeb7151aa42" have entirely different histories.

5 changed files with 53 additions and 46 deletions

View File

@ -1,7 +1,7 @@
<div class="col"> <div class="col">
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-header"> <div class="card-header">
<span class="flex">{{ gallery.title }}</span> <span class="flex">{{ gallary.title }}</span>
<a <a
href="#" href="#"
class="btn btn-link float-end" class="btn btn-link float-end"
@ -15,19 +15,19 @@
<img <img
class="card-image-top" class="card-image-top"
width="{{ gallery.width | default('100%') }}" width="{{ gallary.width | default('100%') }}"
height="{{ gallery.height | default('225') }}" height="{{ gallary.height | default('225') }}"
src="{{ gallery.src }}" src="{{ gallary.src }}"
alt="{{ gallery.alt_text if gallery.alt_text else gallery.title }}" alt="{{ gallary.alt_text if gallary.alt_text else gallary.title }}"
/> />
<div class="card-body"> <div class="card-body">
<p class="card-text">{{ gallery.description | default('') }}</p> <p class="card-text">{{ gallary.description | default('') }}</p>
</div> </div>
<div class="card-footer text-body-secondary text-end"> <div class="card-footer text-body-secondary text-end">
{% if gallery.reactions %} {% if gallary.reactions %}
{% for reaction in gallery.reactions %} {% for reaction in gallary.reactions %}
{# TODO: limit total number of reactions shown #} {# TODO: limit total number of reactions shown #}
<span class="badge rounded-pill"> <span class="badge rounded-pill">
<i class="bi-{{ reaction }}" style="color: black;"></i> <i class="bi-{{ reaction }}" style="color: black;"></i>

View File

@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3"> <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
{% for gallery in gallery_items %} {% for gallary in gallery_items %}
{% include 'card.html' %} {% include 'card.html' %}
{# include 'card_loading.html' #} {# include 'card_loading.html' #}
{% endfor %} {% endfor %}

View File

@ -1,4 +1,4 @@
<!--{# <!--
#~ Var | Required | Default ~# #~ Var | Required | Default ~#
language | no | en language | no | en
css_theme_name | no | auto css_theme_name | no | auto
@ -40,7 +40,7 @@
- type | no | none - type | no | none
- color | no | none - color | no | none
... (etc) ... (etc)
#}--> -->
<!doctype html> <!doctype html>
<html <html

View File

@ -1,4 +1,4 @@
<!--{# <!--
#~ Var | Required | Default ~# #~ Var | Required | Default ~#
theme | no | dark theme | no | dark
text_theme | no | white text_theme | no | white
@ -12,7 +12,7 @@
- text | yes | none - text | yes | none
- icon | no | none - icon | no | none
... (etc) ... (etc)
#}--> -->
<header data-bs-theme="{{ theme | default('dark') }}"> <header data-bs-theme="{{ theme | default('dark') }}">
<div class="collapse text-bg-{{ theme | default('dark') }}" id="navbarHeader"> <div class="collapse text-bg-{{ theme | default('dark') }}" id="navbarHeader">
<div class="container"> <div class="container">

73
test.py
View File

@ -21,76 +21,83 @@ template_vars = {
"bootstrap": { "bootstrap": {
"src": "./templates/example/bootstrap.bundle.min.js", "src": "./templates/example/bootstrap.bundle.min.js",
}, },
"theme": {"src": ".templates/example/color-modes.js"}, "theme": {
"src": ".templates/example/color-modes.js"
}
}, },
"css": { "css": {
"bootstrap": {"src": "./templates/example/bootstrap.min.css"}, "bootstrap": {
"theme": {"src": "./templates/example/gallery.css"}, "src": "./templates/example/bootstrap.min.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": ["This is another line", "This is yet another line"], "extra_lines": [
"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": ["heart-fill", "backpack4", "balloon-fill", "bag-x-fill"], "reactions": [
"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": ["heart", "backpack3", "balloon", "bag-x"], "reactions": [
}, "heart",
], "backpack3",
"balloon",
"bag-x"
],
}
]
} }
def main(): def main():
"""main method""" """main method"""
env = Environment( env = Environment(loader=FileSystemLoader("templates"), autoescape=select_autoescape())
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()