##// END OF EJS Templates
Renaming the special methods of the formatters....
Renaming the special methods of the formatters. The IPython formatters use special methods to compute the format of objects. These special methods have names like "__html__", but with this commit these have been changed to "_repr_html_". I have also added a Javascript formatter and fixed a bug in pylab tools in getfigs.

File last commit:

r3878:43a27cb1
r3878:43a27cb1
Show More
display.py
26 lines | 572 B | text/x-python | PythonLexer
"""Code that shows off the IPython display logic.
"""
from IPython.core.display import (
display, display_pretty, display_html,
display_svg, display_json
)
class Circle(object):
def __init__(self, radius):
self.radius = radius
def _repr_pretty_(self, p, cycle):
p.text(u"\u25CB")
__pretty__ = _repr_pretty_
def _repr_html_(self):
return "<h1>Cirle: radius=%s</h1>" % self.radius
def _repr_svg_(self):
return """<svg>
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/>
</svg>"""