Skip to content

Commit

Permalink
Fix write courses script in case there is no upcoming cours
Browse files Browse the repository at this point in the history
  • Loading branch information
webrian committed Nov 27, 2023
1 parent 35cba0f commit ddedd35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions scripts/template.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% if data|length >= 1 %}
<table class="table table-striped-columns">
<tbody>
<tr>
Expand All @@ -10,3 +11,10 @@
{% endfor %}
</tbody>
</table>
{% else %}
{% if lang == "de" %}
<i>Keine bevorstehenden Veranstaltungen oder Kurse eingetragen</i>
{% else %}
<i>Aucun événement ou cours à venir</i>
{% endif %}
{% endif %}
5 changes: 4 additions & 1 deletion scripts/write-courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def run():
environment = Environment(loader=FileSystemLoader("./"))

for lang in ( "de", "fr" ):
# Define the variables
data = []
header = ("", "", "")

# Get the jinia template to render HTML
template = environment.get_template(f"template.html")
Expand Down Expand Up @@ -49,7 +51,8 @@ def run():
# Render the template with the data
content = template.render(
header=header,
data=data
data=data,
lang=lang
)

# Open the output file to write the rendered template
Expand Down

0 comments on commit ddedd35

Please sign in to comment.