Return an html representation for an object s.
If s has a method _html_(), call that. Otherwise, call math_parse() on str(s), evaluate any variables in the result, and add some html preamble and postamble.
In any case, print the resulting html string. This method always returns an empty string.
EXAMPLES:
sage: html.eval('<hr>')
<html><font color='black'><hr></font></html>
''
Put an existing web page into a worksheet.
INPUT:
OUTPUT:
Opens the url in a worksheet. If the url is a regular web page it will appear in the worksheet. This was originally intended to bring GeoGebra worksheets into Sage, but it can be used for many other purposes.
EXAMPLES:
sage: html.iframe("sagemath.org")
<html><font color='black'><iframe height="400" width="800"
src="http://sagemath.org"></iframe></font></html>
sage: html.iframe("http://sagemath.org",30,40)
<html><font color='black'><iframe height="30" width="40"
src="http://sagemath.org"></iframe></font></html>
sage: html.iframe("https://sagemath.org",30)
<html><font color='black'><iframe height="30" width="800"
src="https://sagemath.org"></iframe></font></html>
sage: html.iframe("/home/admin/0/data/filename")
<html><font color='black'><iframe height="400" width="800"
src="/home/admin/0/data/filename"></iframe></font></html>
sage: html.iframe('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA'
... 'AUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBA'
... 'AO9TXL0Y4OHwAAAABJRU5ErkJggg=="')
<html><font color='black'><iframe height="400" width="800"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==""></iframe></font></html>
AUTHOR:
Print a nested list as a HTML table. Strings of html will be parsed for math inside dollar and double-dollar signs. 2D graphics will be displayed in the cells. Expressions will be latexed.
INPUT:
EXAMPLES:
sage: html.table([(i, j, i == j) for i in [0..1] for j in [0..1]])
<html>
<div class="notruncate">
<table class="table_form">
<tbody>
<tr class ="row-a">
<td><script type="math/tex">0</script></td>
<td><script type="math/tex">0</script></td>
<td><script type="math/tex">\mathrm{True}</script></td>
</tr>
<tr class ="row-b">
<td><script type="math/tex">0</script></td>
<td><script type="math/tex">1</script></td>
<td><script type="math/tex">\mathrm{False}</script></td>
</tr>
<tr class ="row-a">
<td><script type="math/tex">1</script></td>
<td><script type="math/tex">0</script></td>
<td><script type="math/tex">\mathrm{False}</script></td>
</tr>
<tr class ="row-b">
<td><script type="math/tex">1</script></td>
<td><script type="math/tex">1</script></td>
<td><script type="math/tex">\mathrm{True}</script></td>
</tr>
</tbody>
</table>
</div>
</html>
sage: html.table([(x,n(sin(x), digits=2)) for x in [0..3]], header = ["$x$", "$\sin(x)$"])
<html>
<div class="notruncate">
<table class="table_form">
<tbody>
<tr>
<th><script type="math/tex">x</script></th>
<th><script type="math/tex">\sin(x)</script></th>
</tr>
<tr class ="row-a">
<td><script type="math/tex">0</script></td>
<td><script type="math/tex">0.00</script></td>
</tr>
<tr class ="row-b">
<td><script type="math/tex">1</script></td>
<td><script type="math/tex">0.84</script></td>
</tr>
<tr class ="row-a">
<td><script type="math/tex">2</script></td>
<td><script type="math/tex">0.91</script></td>
</tr>
<tr class ="row-b">
<td><script type="math/tex">3</script></td>
<td><script type="math/tex">0.14</script></td>
</tr>
</tbody>
</table>
</div>
</html>
Display the given HTML expression in the notebook.
INPUT:
OUTPUT:
By default in the notebook an output cell has two parts, first a plain text preformat part, then second a general HTML part (not pre). If you call html(s) at any point then that adds something that will be displayed in the preformated part in html.
EXAMPLES:
sage: html('<a href="http://sagemath.org">sagemath</a>')
<html><font color='black'><a href="http://sagemath.org">sagemath</a></font></html>
sage: html('<hr>')
<html><font color='black'><hr></font></html>
Turn the HTML-ish string s that can have $$ and $’s in it into pure HTML. See below for a precise definition of what this means.
INPUT:
OUTPUT:
Do the following:
EXAMPLES:
sage: sage.misc.html.math_parse('This is $2+2$.')
'This is <script type="math/tex">2+2</script>.'
sage: sage.misc.html.math_parse('This is $$2+2$$.')
'This is <script type="math/tex; mode=display">2+2</script>.'
sage: sage.misc.html.math_parse('This is \\[2+2\\].')
'This is <script type="math/tex; mode=display">2+2</script>.'
sage: sage.misc.html.math_parse(r'This is \[2+2\].')
'This is <script type="math/tex; mode=display">2+2</script>.'
TESTS:
sage: sage.misc.html.math_parse(r'This $$is $2+2$.')
'This $$is <script type="math/tex">2+2</script>.'