Skip to content

Commit

Permalink
Add display of default table on html
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-richling committed Dec 2, 2024
1 parent 02ebd3d commit 67b5f24
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
17 changes: 12 additions & 5 deletions lib/adf_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,15 @@ def jinja_enumerate(arg):
"table_html": table_html,
"multi_head": False}
rend_kwarg_dict["plot_types"] = multi_plot_type_html

if web_data.name == case1:
rend_kwarg_dict["disp_table_name"] = case1
rend_kwarg_dict["disp_table_html"] = table_html

if web_data.name == "Case Comparison":
rend_kwarg_dict["disp_table_name"] = "Case Comparison"
rend_kwarg_dict["disp_table_html"] = table_html

table_tmpl = jinenv.get_template('template_table.html')
table_rndr = table_tmpl.render(rend_kwarg_dict)

Expand All @@ -620,10 +629,8 @@ def jinja_enumerate(arg):

#Construct mean_table.html
mean_table_tmpl = jinenv.get_template('template_mean_tables.html')
#Reuse the rend_kwarg_dict, but ignore certain keys
#since all others are the same
new_dict = {k: rend_kwarg_dict[k] for k in rend_kwarg_dict.keys() - {'table_name', 'table_html'}}
mean_table_rndr = mean_table_tmpl.render(new_dict)
#Reuse the rend_kwarg_dict
mean_table_rndr = mean_table_tmpl.render(rend_kwarg_dict)
#Write mean diagnostic tables HTML file:
with open(mean_table_file, 'w', encoding='utf-8') as ofil:
ofil.write(mean_table_rndr)
Expand Down Expand Up @@ -714,7 +721,7 @@ def jinja_enumerate(arg):
index_title = "AMP Diagnostics Prototype"
index_tmpl = jinenv.get_template('template_index.html')
index_rndr = index_tmpl.render(title=index_title,
case_name=case1,
case_name=web_data.case,
base_name=data_name,
case_yrs=case_yrs,
baseline_yrs=baseline_yrs,
Expand Down
18 changes: 11 additions & 7 deletions lib/website_templates/template_mean_tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ <h1>AMWG Tables</h1>
</div>

<div style="width: 100%;">
<table class="big-table">
{% for case_name, html_file in amwg_tables.items() %}
<tr>
<td><a id="amwg_table" href="{{ html_file }}">{{ case_name }}</a></td>
</tr>
{% endfor %}
</table>
<table class="big-table">
{% for case_name, html_file in amwg_tables.items() %}
<tr>
<td><a id="amwg_table" href="{{ html_file }}">{{ case_name }}</a></td>
</tr>
{% endfor %}
</table><br>

<!-- Main Table HTML -->
<h3>{{ disp_table_name }}</h3>
{{ disp_table_html }}
</div>

</body>
Expand Down
20 changes: 10 additions & 10 deletions lib/website_templates/template_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ <h1>AMWG Tables</h1>
</div>

<div style="width: 100%;">
<table class="big-table">
{% for case_name, html_file in amwg_tables.items() %}
<tr>
<td><a id="amwg_table" href="{{ html_file }}">{{ case_name }}</a></td>
</tr>
{% endfor %}
</table>
<table class="big-table">
{% for case_name, html_file in amwg_tables.items() %}
<tr>
<td><a id="amwg_table" href="{{ html_file }}">{{ case_name }}</a></td>
</tr>
{% endfor %}
</table><br>

<!-- Main Table HTML -->
<h3> {{ table_name }} </h3>
{{ table_html }}
<!-- Main Table HTML -->
<h3> {{ table_name }} </h3>
{{ table_html }}
</div>

</body>
Expand Down

0 comments on commit 67b5f24

Please sign in to comment.