Show More
@@ -667,7 +667,7 class Pretty(TextDisplayObject): | |||
|
667 | 667 | class HTML(TextDisplayObject): |
|
668 | 668 | |
|
669 | 669 | def _repr_html_(self): |
|
670 | return self.data | |
|
670 | return self._data_and_metadata() | |
|
671 | 671 | |
|
672 | 672 | def __html__(self): |
|
673 | 673 | """ |
@@ -681,20 +681,23 class HTML(TextDisplayObject): | |||
|
681 | 681 | class Markdown(TextDisplayObject): |
|
682 | 682 | |
|
683 | 683 | def _repr_markdown_(self): |
|
684 | return self.data | |
|
684 | return self._data_and_metadata() | |
|
685 | 685 | |
|
686 | 686 | |
|
687 | 687 | class Math(TextDisplayObject): |
|
688 | 688 | |
|
689 | 689 | def _repr_latex_(self): |
|
690 | s = self.data.strip('$') | |
|
691 | return "$$%s$$" % s | |
|
690 | s = "$$%s$$" % self.data.strip('$') | |
|
691 | if self.metadata: | |
|
692 | return s, deepcopy(self.metadata) | |
|
693 | else: | |
|
694 | return s | |
|
692 | 695 | |
|
693 | 696 | |
|
694 | 697 | class Latex(TextDisplayObject): |
|
695 | 698 | |
|
696 | 699 | def _repr_latex_(self): |
|
697 | return self.data | |
|
700 | return self._data_and_metadata() | |
|
698 | 701 | |
|
699 | 702 | |
|
700 | 703 | class SVG(DisplayObject): |
@@ -275,6 +275,10 def test_video_embedding(): | |||
|
275 | 275 | html = v._repr_html_() |
|
276 | 276 | nt.assert_in('src="data:video/xyz;base64,YWJj"',html) |
|
277 | 277 | |
|
278 | def test_html_metadata(): | |
|
279 | s = "<h1>Test</h1>" | |
|
280 | h = display.HTML(s, metadata={"isolated": True}) | |
|
281 | nt.assert_equal(h._repr_html_(), (s, {"isolated": True})) | |
|
278 | 282 | |
|
279 | 283 | def test_display_id(): |
|
280 | 284 | ip = get_ipython() |
General Comments 0
You need to be logged in to leave comments.
Login now