Moreover, you can output arbitrary HTML as part of a normal
SAGE command and have it appear in HTML in the output.
Just wrap what you print in <html> and </html>. E.g.,
{{{
print '<html>'
for i in range(10):
print '<b><font color=red size=+4> %o </font></b><br>'%i
print '</html>'
///
<html>
<b><font color=red size=+4> 0 </font></b><br>
<b><font color=red size=+4> 1 </font></b><br>
<b><font color=red size=+4> 2 </font></b><br>
<b><font color=red size=+4> 3 </font></b><br>
<b><font color=red size=+4> 4 </font></b><br>
<b><font color=red size=+4> 5 </font></b><br>
<b><font color=red size=+4> 6 </font></b><br>
<b><font color=red size=+4> 7 </font></b><br>
<b><font color=red size=+4> 10 </font></b><br>
<b><font color=red size=+4> 11 </font></b><br>
</html>
}}}
On 3/9/07, David Joyner <[EMAIL PROTECTED]> wrote:
>
> HTML tables can be created in a cell. For example, paste the following
> into a cell:
>
>
> %html
> <p>
> <table style="text-align: center; width: 100%;" border="1"
> cellpadding="2" cellspacing="2>
> <tbody>
> <tr>
> <td> 1 </td><td> 2</td>
> </tr>
> <tr>
> <td> 3 </td><td> 1+2<sup>4</sup></td>
> </tr>
> </tbody>
> </table>
>
> However, if you put anything after the "</table>" you'll get nothing.
> Try pasting this into a cell:
>
> %html
> <table style="text-align: center; width: 100%;" border="1"
> cellpadding="2" cellspacing="2>
> <tbody>
> <tr>
> <td> 1 </td><td> 2</td>
> </tr>
> <tr>
> <td> 3 </td><td> 4</td>
> </tr>
> </tbody>
> </table>
> hi = "Hello World!"
>
> I get nothing at all.
>
>
> On 3/9/07, Timothy Clemans <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I created an interesting html table and colored it, using Python. I
> > tried putting the code into SAGE, but I just could not seem to get it
> > to work (just a bunch of \n's).
> >
> > http://tclemans.nonlogic.org/table.html
> >
> > def dt(s):
> > string = "<html>\n"
> > string += "<head>\n"
> > string += "<title>Factor Table</title>\n"
> > string += "<style>\n"
> > string += "table {margin: 0; padding: 0; border: 1px solid #ccc;}\n"
> > string += "tr {margin: 0; padding: 0; border: 1px solid #ccc;}\n"
> > string += "td {margin: 0; padding: 0; border: 1px solid #ccc;
> > width: 20px; height; 20px;}\n"
> > string += "#yes {background: red; margin: 0; padding: 0; width;
> > 20px; height: 20px;}\n"
> > string += "#no {background: blue; margin: 0; padding: 0; width;
> > 20px; height: 20px;}\n"
> > string += "</style>\n"
> > string += "<body>\n"
> > string += "<table>\n"
> >
> > for a in range(1,s+1):
> > string += "<tr>"
> > for b in range(1,s+1):
> > if a%b == 0:
> > string += '<td id="yes"></td>'
> > else:
> > string += '<td id="no"></td>'
> > string += "</tr>\n"
> > string += "</table>\n</body>\n</html>\n"
> > return string
> >
> > >
> >
>
> >
>
--
William Stein
Associate Professor of Mathematics
University of Washington
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---