Sync
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 37s

This commit is contained in:
2024-12-17 19:06:34 +01:00
parent 7072e7e099
commit dea59f3d23
7 changed files with 52 additions and 27 deletions

View File

@@ -48,14 +48,16 @@ def slider(options, images):
height = options.get("height", 375)
html_content = []
button_content = []
for i, val in enumerate(images):
if i % 2 == 0:
html_content.append(f"""<button onclick="openModal('modal{i}')" class="open"> <img src="{val}" width={width} height={height}> Open Modal {i} </button>""".strip())
else:
html_content.append(f"""<button onclick="openModal('modal{i}')" class="open_inv"> <img src="{val}" width={width} height={height}> Open Modal {i} </button>""".strip())
#for i, val in enumerate(images):
# html_content.append(f"""<button onclick="openModal('modal{i}')" class="open"> Open Modal {i} </button>""")
# button_content.append(f"""<div class="modal" id="modal{i}"> <div class="modal-content"> <h2>Modal {i}</h2> <p>This is modal {i}.</p> <button onclick="closeModal('modal{i}')">Close</button> </div> </div>""")
#html = '\n'.join( html_content )
#print(html)
return """Hej"""
html_content.append(f"""<div class="modal" id="modal{i}"> <div class="modal-content"> <h2>Modal {i}</h2> <p>This is modal {i}.</p> <img src="{val}" width="80%" height="80%"> <button onclick="closeModal('modal{i}')">Close</button> </div> </div>""")
html = '\n'.join( html_content )
return html
def create_jinja_environment():
@@ -92,7 +94,11 @@ def render_markdown_with_jinja(markdown_content: str):
template = env.get_template("base_template")
final_html = template.render(content=intermediate_html)
# Step 3: Re-render final_html in Jinja2 for embedded tags like {{ box(...) }}
final_output = env.from_string(final_html).render()
#Step 3: Re-render final_html in Jinja2 for embedded tags like {{ box(...) }}
try:
final_output = env.from_string(final_html).render()
except:
print(final_html)
return final_output, metadata