@@ -54,16 +54,15 @@ function limitstringmime(mime::MIME, x)
54
54
return String (take! (buf))
55
55
end
56
56
57
- for mime in ipy_mime
57
+ for mimestr in ipy_mime
58
+ M = MIME{Symbol (mimestr)}
58
59
@eval begin
59
- function display (d:: InlineDisplay , :: MIME{Symbol($mime)} , x)
60
- send_ipython (publish[],
61
- msg_pub (execute_msg, " display_data" ,
62
- Dict (
63
- " metadata" => metadata (x), # optional
64
- " data" => Dict ($ mime => limitstringmime (MIME ($ mime), x)))))
60
+ function display (d:: InlineDisplay , :: $M , x)
61
+ s = limitstringmime ($ M (), x)
62
+ m = get (metadata (x), $ mimestr, Dict ())
63
+ display_data ($ M (), s, m)
65
64
end
66
- displayable (d:: InlineDisplay , :: MIME{Symbol($mime)} ) = true
65
+ displayable (d:: InlineDisplay , :: $M ) = true
67
66
end
68
67
end
69
68
@@ -76,26 +75,21 @@ display(d::InlineDisplay, m::MIME"text/javascript", x) = display(d, MIME("applic
76
75
# If the user explicitly calls display("foo/bar", x), we send
77
76
# the display message, also sending text/plain for text data.
78
77
displayable (d:: InlineDisplay , M:: MIME ) = istextmime (M)
78
+
79
79
function display (d:: InlineDisplay , M:: MIME , x)
80
80
sx = limitstringmime (M, x)
81
81
d = Dict (string (M) => sx)
82
82
if istextmime (M)
83
83
d[" text/plain" ] = sx # directly show text data, e.g. text/csv
84
84
end
85
- send_ipython (publish[],
86
- msg_pub (execute_msg, " display_data" ,
87
- Dict (" metadata" => metadata (x), # optional
88
- " data" => d)))
85
+ display_data (d, metadata (x))
89
86
end
90
87
91
88
# override display to send IPython a dictionary of all supported
92
89
# output types, so that IPython can choose what to display.
93
90
function display (d:: InlineDisplay , x)
94
91
undisplay (x) # dequeue previous redisplay(x)
95
- send_ipython (publish[],
96
- msg_pub (execute_msg, " display_data" ,
97
- Dict (" metadata" => metadata (x), # optional
98
- " data" => display_dict (x))))
92
+ display_data (display_dict (x), metadata (x))
99
93
end
100
94
101
95
# we overload redisplay(d, x) to add x to a queue of objects to display,
0 commit comments