From 0f75811000221c17ff2ed2663bb6045dac3a6e14 Mon Sep 17 00:00:00 2001 From: c0de Date: Wed, 27 Dec 2023 19:32:17 -0600 Subject: [PATCH 01/52] Update license to my new name --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 104b7c4..0218bfb 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 David Todd (c0de@c0defox.es) +Copyright (c) 2023 Code Fox Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal -- 2.34.1 From 03b9bf6e631d89c60c18ddf96e7dbe11811efe93 Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 21:12:38 -0600 Subject: [PATCH 02/52] delete original templates --- templates/root_gallery.html | 123 -------------------------------- templates/sub_gallery.html | 137 ------------------------------------ 2 files changed, 260 deletions(-) delete mode 100644 templates/root_gallery.html delete mode 100644 templates/sub_gallery.html diff --git a/templates/root_gallery.html b/templates/root_gallery.html deleted file mode 100644 index 78ddfc2..0000000 --- a/templates/root_gallery.html +++ /dev/null @@ -1,123 +0,0 @@ - - - Simple S3 Gallery - - - - - - - - - - - - -
- - -
- -
- - - - -
-
-
- {{THUMBROW}} -
-
-
-
- - - - - - - - diff --git a/templates/sub_gallery.html b/templates/sub_gallery.html deleted file mode 100644 index 7d80010..0000000 --- a/templates/sub_gallery.html +++ /dev/null @@ -1,137 +0,0 @@ - - - Simple S3 Gallery - - - - - - - - - - - - -
- - -
- -
- - - - -
-
-
- {{THUMBROW}} -
-
-
-
- - - - - - - - -- 2.34.1 From 0ed2e1ee7b95c7a0f058fa6246947569c13a96c4 Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 21:13:59 -0600 Subject: [PATCH 03/52] ignore examples --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9857ee0..0c91677 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ GenThumb.log index*.html .vscode gallery.html +**/example/** -- 2.34.1 From 4edd2fb59d3fbb912fb4bbadf3b4135b4211b97a Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 21:14:10 -0600 Subject: [PATCH 04/52] Create a bunch of templates --- templates/base.html | 13 ++++ templates/body_bottom.html | 9 +++ templates/body_top.html | 53 ++++++++++++++ templates/call_to_action.html | 45 ++++++++++++ templates/card.html | 46 ++++++++++-- templates/card_loading.html | 23 ++++++ templates/footer.html | 23 ++++++ templates/header.html | 130 ++++++++++++++++++++++++++++++++++ templates/navbar.html | 62 ++++++++++++++++ 9 files changed, 397 insertions(+), 7 deletions(-) create mode 100644 templates/base.html create mode 100644 templates/body_bottom.html create mode 100644 templates/body_top.html create mode 100644 templates/call_to_action.html create mode 100644 templates/card_loading.html create mode 100644 templates/footer.html create mode 100644 templates/header.html create mode 100644 templates/navbar.html diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..e9f3473 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,13 @@ +{% include 'header.html' %} +{% include 'body_top.html' %} + +{% include 'navbar.html' %} + +
+ {% include 'call_to_action.html' %} + + {% include 'gallery.html' %} +
+ +{% include 'footer.html' %} +{% include 'body_bottom.html' %} diff --git a/templates/body_bottom.html b/templates/body_bottom.html new file mode 100644 index 0000000..1f55d42 --- /dev/null +++ b/templates/body_bottom.html @@ -0,0 +1,9 @@ +{% if static.scripts.bootstrap %} + +{% endif %} + + diff --git a/templates/body_top.html b/templates/body_top.html new file mode 100644 index 0000000..7f40b4d --- /dev/null +++ b/templates/body_top.html @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/templates/call_to_action.html b/templates/call_to_action.html new file mode 100644 index 0000000..a1180cd --- /dev/null +++ b/templates/call_to_action.html @@ -0,0 +1,45 @@ + +{% if active | default(false) %} +
+
+
+

{{ header }}

+

{{ lead_text }}

+ + {% if action_buttons %} +

+ {% for button in action_buttons %} + + {{ button.text }} + {% if button.icon %} + + + + {% endif %} + + {% endfor %} +

+ {% endif %} +
+
+
+{% endif %} diff --git a/templates/card.html b/templates/card.html index 9f3a464..be22618 100644 --- a/templates/card.html +++ b/templates/card.html @@ -1,8 +1,40 @@ -
- -
-
{{TITLE}}
- -
-
+
+
+
+ + + +
+ + {{ alt_text if alt_text else title }} + +
+
{{ title }}
+

{{ description | default('') }}

+
+ + + +
diff --git a/templates/card_loading.html b/templates/card_loading.html new file mode 100644 index 0000000..1a9cffb --- /dev/null +++ b/templates/card_loading.html @@ -0,0 +1,23 @@ +
+ +
diff --git a/templates/footer.html b/templates/footer.html new file mode 100644 index 0000000..13ddaf7 --- /dev/null +++ b/templates/footer.html @@ -0,0 +1,23 @@ + + +
+
+

+ Back to top +

+

{{ main_line | default('') }}

+ + {% if extra_lines %} + {% for line in extra_lines %} + {% if line %} +

{{ line }}

+ {% endif %} + {% endfor %} + {% endif %} +
+
diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..d37ea5b --- /dev/null +++ b/templates/header.html @@ -0,0 +1,130 @@ + + + + + + {% if static.scripts.theme %} + + {% endif %} + + + + + {{ page_title }} + + {% if meta_list %} + + {% for meta in meta_list %} + + {% endfor %} + {% endif %} + + + + {% if favicon_list %} + + {% for icon in favicon_list %} + + {% endfor %} + {% endif %} + + + + {% if static.css.bootstrap %} + + {% endif %} + + {% if static.css.theme %} + + {% endif %} + + {% if static.css.icons %} + + {% endif %} + + diff --git a/templates/navbar.html b/templates/navbar.html new file mode 100644 index 0000000..057328f --- /dev/null +++ b/templates/navbar.html @@ -0,0 +1,62 @@ + +
+ + + +
-- 2.34.1 From 8a28bd5ce263be411315f45476ce6f466d10f41d Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 22:06:17 -0600 Subject: [PATCH 05/52] ignore venv --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0c91677..fda489f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ index*.html .vscode gallery.html **/example/** +**/*venv/** -- 2.34.1 From 26acdaf66a90a876937dd4e234f2bf4b4541f445 Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 22:07:38 -0600 Subject: [PATCH 06/52] use different way for bootstrap icons --- templates/call_to_action.html | 10 ++-------- templates/card.html | 4 ++-- templates/navbar.html | 9 ++------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/templates/call_to_action.html b/templates/call_to_action.html index a1180cd..3ac44e0 100644 --- a/templates/call_to_action.html +++ b/templates/call_to_action.html @@ -25,16 +25,10 @@ href="{{ button.href | default('#') }}" class="btn btn-{{ button.theme | default('primary') }} my-2 d-inline-flex" > - {{ button.text }} {% if button.icon %} - - - + {% endif %} + {{ button.text }} {% endfor %}

diff --git a/templates/card.html b/templates/card.html index be22618..36d68a1 100644 --- a/templates/card.html +++ b/templates/card.html @@ -8,7 +8,7 @@ data-bs-placement="top" data-bs-title="Add a reaction" > - +
@@ -30,7 +30,7 @@ {% for reaction in reactions %} {# TODO: limit total number of reactions shown #} - + {% endfor %} {% endif %} diff --git a/templates/navbar.html b/templates/navbar.html index 057328f..bae9833 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -10,6 +10,7 @@ n. (list index) - href | yes | none - text | yes | none + - icon | no | none ... (etc) -->
@@ -29,13 +30,7 @@ {% if link.href and link.text %}
  • {% if link.icon %} - - - + {% endif %} {{ link.text }}
  • -- 2.34.1 From d6c66161a506e6364b75344b657779b4352eba19 Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 22:08:02 -0600 Subject: [PATCH 07/52] update header docs, remove commented meta tags --- templates/header.html | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/templates/header.html b/templates/header.html index d37ea5b..492c7a6 100644 --- a/templates/header.html +++ b/templates/header.html @@ -4,8 +4,8 @@ css_theme_name | no | auto canonical_url | yes | none page_title | yes | none - static (list) - - scripts (list) + static (dict) + - scripts (dict) - bootstrap (used in footer.html) - src | yes | none - integrity | no | empty @@ -14,7 +14,7 @@ - src | yes | none - integrity | no | empty - crossorigin | no | empty if no integrity, anonymous otherwise - - css (list) + - css (dict) - bootstrap - src | yes | none - integrity | no | empty @@ -57,6 +57,7 @@ {% endif %} + {{ page_title }} @@ -68,15 +69,6 @@ {% endfor %} {% endif %} - - {% if favicon_list %} {% for icon in favicon_list %} -- 2.34.1 From df7042942bde67417026b7ec2cb72e013cd2e7c3 Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 22:08:20 -0600 Subject: [PATCH 08/52] put footer text into own dict --- templates/footer.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/footer.html b/templates/footer.html index 13ddaf7..8cb6030 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -10,10 +10,10 @@

    Back to top

    -

    {{ main_line | default('') }}

    +

    {{ footer.main_line | default('') }}

    - {% if extra_lines %} - {% for line in extra_lines %} + {% if footer.extra_lines %} + {% for line in footer.extra_lines %} {% if line %}

    {{ line }}

    {% endif %} -- 2.34.1 From 7cbfe6e346127be4ea0f5ab74c537c30de2b49da Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 22:09:37 -0600 Subject: [PATCH 09/52] Create test render script --- test.py | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..3e070d1 --- /dev/null +++ b/test.py @@ -0,0 +1,89 @@ +#!/usr/bin/python3 + +""" +test template rendering +python3 test.py | tee test.html +python3 -m http.server +""" + +from jinja2 import Environment, FileSystemLoader, select_autoescape + +template_vars = { + "charset": "utf-8", + "language": "en", + "css_theme_name": "auto", + "canonical_url": "http://example.com", + "page_title": "This is a title", + "theme": "dark", + "text_theme": "white", + "static": { + "scripts": { + "bootstrap": { + "src": "./templates/example/bootstrap.bundle.min.js", + }, + "theme": { + "src": ".templates/example/color-modes.js" + } + }, + "css": { + "bootstrap": { + "src": "./templates/example/bootstrap.min.css" + }, + "theme": { + "src": "./templates/example/gallery.css" + }, + "icons": { + "src": "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css" + } + } + }, + "meta_list": [ + { "name": "description", "content": "This is a description" }, + { "name": "generator", "content": "simple-s3-gallery v.2023.12" }, + { "name": "author", "content": "Code Fox" }, + { "name": "theme-color", "content": "#712cf9" } + ], + "left_header": "About the gallery", + "left_text": "This is an example gallery that is generated via a template", + "right_header": "Contact", + "link_list": [ + { "href": "https://c0defox.es", "text": "Fox :3" }, + { "href": "https://furry.engineer/c0de", "text": "Mastodon", "icon": "mastodon" } + ], + "reactions": [ + "heart-fill", + "backpack4", + "balloon-fill", + "bag-x-fill" + ], + "footer": { + "main_line": "Copyright 2024 Code Fox", + "extra_lines": [ + "This is another line", + "This is yet another line" + ] + }, + "active": True, + "header": "This is a call to action", + "lead_text": "Some interesting text for the user", + "action_buttons": [ + { "href": "1" }, + { "href": "2", "theme": "danger" }, + { "href": "3", "theme": "warning", "icon": "exclamation-diamond-fill" }, + { "href": "3", "theme": "warning", "icon": "exclamation-diamond-fill", "text": "some text" } + ], + "gallery_items": { + "test": "test", + "test2": "test2" + } +} + +def main(): + """main method""" + + env = Environment(loader=FileSystemLoader("templates"), autoescape=select_autoescape()) + template = env.get_template("base.html") + print(template.render(**template_vars)) + +if __name__ == "__main__": + main() -- 2.34.1 From 50a67a5491dfdc35a66eb392928eba22066e1efd Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 22:09:55 -0600 Subject: [PATCH 10/52] ignore test.html --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index fda489f..9773f98 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ index*.html gallery.html **/example/** **/*venv/** +test.html + -- 2.34.1 From c846c8e78971b94f22ed2c364f145b1fa090a52c Mon Sep 17 00:00:00 2001 From: c0de Date: Thu, 28 Dec 2023 22:40:33 -0600 Subject: [PATCH 11/52] Fix rendering of the cards --- templates/card.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/templates/card.html b/templates/card.html index 36d68a1..673493b 100644 --- a/templates/card.html +++ b/templates/card.html @@ -1,36 +1,36 @@
    -
    +
    + {{ gallary.title }} - +
    {{ alt_text if alt_text else title }}
    -
    {{ title }}
    -

    {{ description | default('') }}

    +

    {{ gallary.description | default('') }}