Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: table template ignoring text format #1462

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<tr{% if 'alert' in row and row['alert'] %} class="alert"{% endif %}>
<th>{{ row['name'] }}</th>
{% if row['value'].__class__.__name__ == 'list' %}
{% for value in row['value'] %}
<td>{{ value }}{% if loop.last and 'hint' in row %} {{ row['hint'] }}{% endif %}</td>
{% for value in row['value'] +%}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the '+' sign should not be there? I'm recieving the error 'TemplateSyntaxError: unexpected 'end of statement block'' when running this code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaking the render to html profile...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true, removing it fixed the HTML render

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error was fixed in #1491 and will be added to the next release

<td style="white-space:pre white-space:nowrap">{{ value }}{% if loop.last and 'hint' in row %} {{ row['hint'] }}{% endif %}</td>
{% endfor %}
{% else %}
<td>{{ row['value'] }}{% if 'hint' in row %} {{ row['hint'] }}{% endif %}</td>
<td style="white-space:pre white-space:nowrap">{{ row['value'] }}{% if 'hint' in row %} {{ row['hint'] }}{% endif %}</td>
{% endif %}
</tr>
{% endfor %}
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def html_profile() -> str:
def test_timeseries_identification(html_profile: str):
assert "<th>TimeSeries</th>" in html_profile, "TimeSeries not detected"
assert (
"<tr><th>TimeSeries</th><td>8</td></tr>" in html_profile
'<tr><th>TimeSeries</th><td style="white-space:pre white-space:nowrap">8</td></tr>'
in html_profile
), "TimeSeries incorrectly identified"


Expand Down