Skip to content

Fix HTML output #18292

@vbraun

Description

@vbraun

Html output also suffers from the EMBEDDED_MODE syndrome, it should actually return html expressions (instead of the empty string) and not rely on print()ing HTML to the screen doing anything.

The current behavior is:

sage: n=7
sage: L = map(None,[p for p in prime_range(n+1) if p%4==1],[p for p in prime_range(n+1) if p%4==3])
sage: L = [['',l[1]] if l[0] is None else l for l in L]
sage: T = [['$p\equiv 1\\text{ mod }(4)$','$p\equiv 3\\text{ mod }(4)$']]
sage: output = html(table(T+L,header_row=True))   # print() to stdout???
<html>
<div class="notruncate">
<table  class="table_form">
<tbody>
<tr>
<th><script type="math/tex">p\equiv 1\text{ mod }(4)</script></th>
<th><script type="math/tex">p\equiv 3\text{ mod }(4)</script></th>
</tr>
<tr class ="row-a">
<td><script type="math/tex">5</script></td>
<td><script type="math/tex">3</script></td>
</tr>
<tr class ="row-b">
<td></td>
<td><script type="math/tex">7</script></td>
</tr>
</tbody>
</table>
</div>
</html>
sage: repr(output)     # what?
''
sage: type(output)
<class 'sage.misc.html.HTMLExpr'>

CC: @novoselt @kcrisman @jhpalmieri

Component: notebook

Author: Volker Braun

Branch: 553d2bb

Reviewer: Andrey Novoseltsev

Issue created by migration from https://trac.sagemath.org/ticket/18292

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions