@@ -149,17 +149,15 @@ function limitstringmime(mime::MIME, x)
149
149
return String (take! (buf))
150
150
end
151
151
152
- for mime in ipy_mime
152
+ for mimestr in ipy_mime
153
+ M = MIME{Symbol (mimestr)}
153
154
@eval begin
154
- function display (d:: InlineDisplay , :: MIME{Symbol($mime)} , x)
155
- flush_all () # so that previous stream output appears in order
156
- send_ipython (publish[],
157
- msg_pub (execute_msg, " display_data" ,
158
- Dict (
159
- " metadata" => metadata (x), # optional
160
- " data" => Dict ($ mime => limitstringmime (MIME ($ mime), x)))))
155
+ function display (d:: InlineDisplay , :: $M , x)
156
+ s = limitstringmime ($ M (), x)
157
+ m = get (metadata (x), $ mimestr, Dict ())
158
+ display_data ($ M (), s, m)
161
159
end
162
- displayable (d:: InlineDisplay , :: MIME{Symbol($mime)} ) = true
160
+ displayable (d:: InlineDisplay , :: $M ) = true
163
161
end
164
162
end
165
163
@@ -172,28 +170,21 @@ display(d::InlineDisplay, m::MIME"text/javascript", x) = display(d, MIME("applic
172
170
# If the user explicitly calls display("foo/bar", x), we send
173
171
# the display message, also sending text/plain for text data.
174
172
displayable (d:: InlineDisplay , M:: MIME ) = istextmime (M)
173
+
175
174
function display (d:: InlineDisplay , M:: MIME , x)
176
175
sx = limitstringmime (M, x)
177
- d = Dict (string (M) => sx)
176
+ bundle = Dict (string (M) => sx)
178
177
if istextmime (M)
179
- d [" text/plain" ] = sx # directly show text data, e.g. text/csv
178
+ bundle [" text/plain" ] = sx # directly show text data, e.g. text/csv
180
179
end
181
- flush_all () # so that previous stream output appears in order
182
- send_ipython (publish[],
183
- msg_pub (execute_msg, " display_data" ,
184
- Dict (" metadata" => metadata (x), # optional
185
- " data" => d)))
180
+ display_data (bundle, metadata (x))
186
181
end
187
182
188
183
# override display to send IPython a dictionary of all supported
189
184
# output types, so that IPython can choose what to display.
190
185
function display (d:: InlineDisplay , x)
191
186
undisplay (x) # dequeue previous redisplay(x)
192
- flush_all () # so that previous stream output appears in order
193
- send_ipython (publish[],
194
- msg_pub (execute_msg, " display_data" ,
195
- Dict (" metadata" => metadata (x), # optional
196
- " data" => display_dict (x))))
187
+ display_data (display_dict (x), metadata (x))
197
188
end
198
189
199
190
# we overload redisplay(d, x) to add x to a queue of objects to display,
0 commit comments