← oracle_full

rich_3043

failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich

Task input

Fix the HTML export template

This PR fixes the HTML export template, addressing the issue raised in #3021

In doing so there's also an update to the pre-commit configuration (without it I wasn't able to commit the change -- the update is stolen from the same config file in Textual).

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Patch

--- a/rich/_export_format.py
+++ b/rich/_export_format.py
@@ -1,5 +1,6 @@
 CONSOLE_HTML_FORMAT = """\
 <!DOCTYPE html>
+<html>
 <head>
 <meta charset="UTF-8">
 <style>
@@ -10,7 +11,6 @@
 }}
 </style>
 </head>
-<html>
 <body>
     <pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code>{code}</code></pre>
 </body>

Test output

show
....................F
=================================== FAILURES ===================================
_______________________________ test_print_json ________________________________

    def test_print_json():
        console = Console(file=io.StringIO(), color_system="truecolor")
        console.print_json('[false, true, null, "foo"]', indent=4)
        result = console.file.getvalue()
        print(repr(result))
        expected = '\x1b[1m[\x1b[0m\n    \x1b[3;91mfalse\x1b[0m,\n    \x1b[3;92mtrue\x1b[0m,\n    \x1b[3;35mnull\x1b[0m,\n    \x1b[32m"foo"\x1b[0m\n\x1b[1m]\x1b[0m\n'
>       assert result == expected
E       AssertionError: assert '\x1b[1m[\x1b...[1m]\x1b[0m\n' == '\x1b[1m[\x1b...[1m]\x1b[0m\n'
E         
E           [
E         -     false,
E         ?        ---
E         +     false,
E         -     true,
E         ?        ---...
E         
E         ...Full output truncated (7 lines hidden), use '-vv' to show

tests/test_console.py:216: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[1m[\x1b[0m\n    \x1b[3mfalse\x1b[0m,\n    \x1b[3mtrue\x1b[0m,\n    \x1b[3mnull\x1b[0m,\n    "foo"\n\x1b[1m]\x1b[0m\n'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 20 passed in 0.19s