mirror of
https://github.com/Textualize/rich.git
synced 2026-02-06 10:58:48 +00:00
* Fix #3104 * Fixing tests to account for new inline styles in HTML export * Update changelog * Add Aaron Beaudoin to contributors file. --------- Co-authored-by: Darren Burns <darrenb900@gmail.com>
This commit is contained in:
parent
9f620dc50c
commit
92e7164773
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Adds missing parameters to Panel.fit https://github.com/Textualize/rich/issues/3142
|
||||
|
||||
### Fixed
|
||||
|
||||
- Ensure font is correctly inherited in exported HTML https://github.com/Textualize/rich/issues/3104
|
||||
|
||||
## [13.6.0] - 2023-09-30
|
||||
|
||||
### Added
|
||||
|
||||
@ -73,3 +73,4 @@ The following people have contributed to the development of Rich:
|
||||
- [James Addison](https://github.com/jayaddison)
|
||||
- [Pierro](https://github.com/xpierroz)
|
||||
- [Bernhard Wagner](https://github.com/bwagner)
|
||||
- [Aaron Beaudoin](https://github.com/AaronBeaudoin)
|
||||
|
||||
@ -12,7 +12,7 @@ body {{
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code>{code}</code></pre>
|
||||
<pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code style="font-family:inherit">{code}</code></pre>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
@ -529,7 +529,7 @@ def test_export_html():
|
||||
console.print("[b]foo <script> 'test' [link=https://example.org]Click[/link]")
|
||||
html = console.export_html()
|
||||
print(repr(html))
|
||||
expected = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<style>\n.r1 {font-weight: bold}\n.r2 {color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold}\n.r3 {color: #008000; text-decoration-color: #008000; font-weight: bold}\nbody {\n color: #000000;\n background-color: #ffffff;\n}\n</style>\n</head>\n<body>\n <pre style="font-family:Menlo,\'DejaVu Sans Mono\',consolas,\'Courier New\',monospace"><code><span class="r1">foo <</span><span class="r2">script</span><span class="r1">> </span><span class="r3">'test'</span><span class="r1"> </span><a class="r1" href="https://example.org">Click</a>\n</code></pre>\n</body>\n</html>\n'
|
||||
expected = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<style>\n.r1 {font-weight: bold}\n.r2 {color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold}\n.r3 {color: #008000; text-decoration-color: #008000; font-weight: bold}\nbody {\n color: #000000;\n background-color: #ffffff;\n}\n</style>\n</head>\n<body>\n <pre style="font-family:Menlo,\'DejaVu Sans Mono\',consolas,\'Courier New\',monospace"><code style="font-family:inherit"><span class="r1">foo <</span><span class="r2">script</span><span class="r1">> </span><span class="r3">'test'</span><span class="r1"> </span><a class="r1" href="https://example.org">Click</a>\n</code></pre>\n</body>\n</html>\n'
|
||||
assert html == expected
|
||||
|
||||
|
||||
@ -538,7 +538,7 @@ def test_export_html_inline():
|
||||
console.print("[b]foo [link=https://example.org]Click[/link]")
|
||||
html = console.export_html(inline_styles=True)
|
||||
print(repr(html))
|
||||
expected = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<style>\n\nbody {\n color: #000000;\n background-color: #ffffff;\n}\n</style>\n</head>\n<body>\n <pre style="font-family:Menlo,\'DejaVu Sans Mono\',consolas,\'Courier New\',monospace"><code><span style="font-weight: bold">foo </span><span style="font-weight: bold"><a href="https://example.org">Click</a></span>\n</code></pre>\n</body>\n</html>\n'
|
||||
expected = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<style>\n\nbody {\n color: #000000;\n background-color: #ffffff;\n}\n</style>\n</head>\n<body>\n <pre style="font-family:Menlo,\'DejaVu Sans Mono\',consolas,\'Courier New\',monospace"><code style="font-family:inherit"><span style="font-weight: bold">foo </span><span style="font-weight: bold"><a href="https://example.org">Click</a></span>\n</code></pre>\n</body>\n</html>\n'
|
||||
assert html == expected
|
||||
|
||||
|
||||
@ -591,7 +591,7 @@ def test_save_text():
|
||||
|
||||
|
||||
def test_save_html():
|
||||
expected = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<style>\n\nbody {\n color: #000000;\n background-color: #ffffff;\n}\n</style>\n</head>\n<body>\n <pre style=\"font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><code>foo\n</code></pre>\n</body>\n</html>\n"
|
||||
expected = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<style>\n\nbody {\n color: #000000;\n background-color: #ffffff;\n}\n</style>\n</head>\n<body>\n <pre style="font-family:Menlo,\'DejaVu Sans Mono\',consolas,\'Courier New\',monospace"><code style="font-family:inherit">foo\n</code></pre>\n</body>\n</html>\n'
|
||||
console = Console(record=True, width=100)
|
||||
console.print("foo")
|
||||
with tempfile.TemporaryDirectory() as path:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user