Skip to content

Commit

Permalink
Make Github display the <pre> nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
yfyf committed Oct 23, 2024
1 parent 74442e1 commit d410aa7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions testing/end-to-end/gen-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@ def format_markdown(full_report):
bold_f = lambda s: f"**{s}**"
ok_f = lambda s: f"{s} :heavy_check_mark:"
fail_f = lambda s: f"{s} :x:"
log_f = lambda logs: f"""<details><summary>Last logs:</summary><pre>
{textwrap.indent(html.escape(logs), 4 * ' ')}
</pre></details>"""
def log_f(logs):
lines = html.escape(logs).splitlines()
lines = [l if l.strip() else "<br/>" for l in lines]
log_str = "\n".join(lines)
return "\n" + textwrap.indent(f"""\
<details>
<summary>Last logs:</summary>
<pre>
{log_str}
</pre>
</details>""", 4 * ' ')
return format_gen(full_report, bold_f, ok_f, fail_f, log_f)


Expand Down

0 comments on commit d410aa7

Please sign in to comment.