##// END OF EJS Templates
Added __html__() method to the HTML class so that other Python modules...
Dan McDougall -
Show More
@@ -38,10 +38,10 b' def _safe_exists(path):'
38 38
39 39 def _merge(d1, d2):
40 40 """Like update, but merges sub-dicts instead of clobbering at the top level.
41
41
42 42 Updates d1 in-place
43 43 """
44
44
45 45 if not isinstance(d2, dict) or not isinstance(d1, dict):
46 46 return d2
47 47 for key, value in d2.items():
@@ -107,7 +107,7 b' def display(*objs, **kwargs):'
107 107 metadata = kwargs.get('metadata')
108 108
109 109 from IPython.core.interactiveshell import InteractiveShell
110
110
111 111 if raw:
112 112 for obj in objs:
113 113 publish_display_data('display', obj, metadata)
@@ -337,6 +337,14 b' class HTML(DisplayObject):'
337 337 def _repr_html_(self):
338 338 return self.data
339 339
340 def __html__(self):
341 """
342 This method exists to inform other HTML-using modules (e.g. Markupsafe,
343 htmltag, etc) that this object is HTML and does not need things like
344 special characters (<>&) escaped.
345 """
346 return self._repr_html_()
347
340 348
341 349 class Math(DisplayObject):
342 350
@@ -559,7 +567,7 b' class Image(DisplayObject):'
559 567 if self.height:
560 568 height = ' height="%d"' % self.height
561 569 return u'<img src="%s"%s%s/>' % (self.url, width, height)
562
570
563 571 def _data_and_metadata(self):
564 572 """shortcut for returning metadata with shape information, if defined"""
565 573 md = {}
General Comments 0
You need to be logged in to leave comments. Login now