# HG changeset patch # Date 1308156704 25200 # User Bruce Cohen # Parent ce324e28c3334398d3552640e2cb1520d22465a3 trac 11489 adding html.iframe method diff --git a/sage/misc/html.py b/sage/misc/html.py --- a/sage/misc/html.py +++ b/sage/misc/html.py @@ -293,4 +293,54 @@ + latex(row[column]).replace('\\texttt','\\hbox') + '') + + + + + def iframe(self, url, height=400, width=800): + """ + Put an existing web page into a worksheet. + + INPUT: + + - ``url`` -- a url string. Either with or without "http://". + - ``height`` -- the number of pixels for the page height. + Defaults to 400. + - ``width`` -- the number of pixels for the page width. + Defaults to 800. + + 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") + + + sage: html.iframe("http://sagemath.org",30,40) + + + sage: html.iframe("https://sagemath.org",30) + + + AUTHOR: + + - Bruce Cohen (2011-06-14) + """ + if not url.startswith("http"): + url="http://"+url + string=''%(height, + width, + url) + return html(string) + + html = HTML()