Static Page Generator #5
2 changed files with 9 additions and 1 deletions
8
main.py
8
main.py
|
@ -34,6 +34,14 @@ def icon(icon_name):
|
||||||
env.filters["icon"] = icon
|
env.filters["icon"] = icon
|
||||||
|
|
||||||
|
|
||||||
|
# Filter for rendering a month name from a number
|
||||||
|
def month_name(month_number):
|
||||||
|
return datetime.date(1900, int(month_number), 1).strftime("%B")
|
||||||
|
|
||||||
|
|
||||||
|
env.filters["month_name"] = month_name
|
||||||
|
|
||||||
|
|
||||||
def render_template_to_file(template_name, output_name, **kwargs):
|
def render_template_to_file(template_name, output_name, **kwargs):
|
||||||
try:
|
try:
|
||||||
template = env.get_template(template_name)
|
template = env.get_template(template_name)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{% for month, month_data in year_data.items() %}
|
{% for month, month_data in year_data.items() %}
|
||||||
<div class="card shadow-sm mt-4">
|
<div class="card shadow-sm mt-4">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Transparency Report for {{ month }}/{{ year }}</h5>
|
<h5 class="card-title">Transparency Report for {{ month|month_name }} {{ year }}</h5>
|
||||||
<div class="table-responsive">{{ month_data|safe }}</div>
|
<div class="table-responsive">{{ month_data|safe }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue