generated from hjess/PythonTemplateProject
https enforcement
This commit is contained in:
@@ -27,9 +27,6 @@ class Application:
|
||||
# Process Markdown files into HTML
|
||||
processor = MarkdownProcessor(input_dir="./data", templates_dir="./templates")
|
||||
processor.run()
|
||||
|
||||
|
||||
|
||||
yield
|
||||
print("App shutdown: Cleanup complete.")
|
||||
|
||||
|
||||
@@ -41,6 +41,37 @@ def warning(content):
|
||||
</div>
|
||||
'''
|
||||
|
||||
|
||||
def slider(options, images):
|
||||
"""Render a slider using the provided HTML structure."""
|
||||
width = options.get("width", 500)
|
||||
height = options.get("height", 375)
|
||||
|
||||
# First image with a <figure> and <figcaption>
|
||||
first_image_html = f'''
|
||||
<figure class="relative my-0 slider-bg">
|
||||
<img src="{images[0]}" width="{width}" height="{height}">
|
||||
<figcaption class="absolute inset-0 flex flex-col justify-end p-6">
|
||||
<h1 class="my-0">Fylgja CSS Slider</h1>
|
||||
</figcaption>
|
||||
</figure>
|
||||
'''
|
||||
## Todo: https://codepen.io/dp_lewis/pen/WNZQzN
|
||||
# Remaining images as plain <img> tags
|
||||
other_images_html = "".join([
|
||||
f'<img src="{img}" width="{width}" height="{height}">' for img in images[1:]
|
||||
])
|
||||
|
||||
# Final combined HTML
|
||||
return f'''
|
||||
<main>
|
||||
<div class="scroll-slider hide-scrollbar">
|
||||
{first_image_html}
|
||||
{other_images_html}
|
||||
</div>
|
||||
</main>
|
||||
'''
|
||||
|
||||
def create_jinja_environment():
|
||||
"""Create and configure the Jinja2 environment."""
|
||||
env = Environment(loader=DictLoader({"base_template": "{{ content | safe }}"}))
|
||||
@@ -50,6 +81,7 @@ def create_jinja_environment():
|
||||
"note": note,
|
||||
"warning": warning,
|
||||
"link_to": link_to,
|
||||
"slider": slider,
|
||||
})
|
||||
return env
|
||||
|
||||
|
||||
Reference in New Issue
Block a user