@@ -54,16 +54,15 @@ function limitstringmime(mime::MIME, x)
5454 return String (take! (buf))
5555end
5656
57- for mime in ipy_mime
57+ for mimestr in ipy_mime
58+ M = MIME{Symbol (mimestr)}
5859 @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)
6564 end
66- displayable (d:: InlineDisplay , :: MIME{Symbol($mime)} ) = true
65+ displayable (d:: InlineDisplay , :: $M ) = true
6766 end
6867end
6968
@@ -76,26 +75,21 @@ display(d::InlineDisplay, m::MIME"text/javascript", x) = display(d, MIME("applic
7675# If the user explicitly calls display("foo/bar", x), we send
7776# the display message, also sending text/plain for text data.
7877displayable (d:: InlineDisplay , M:: MIME ) = istextmime (M)
78+
7979function display (d:: InlineDisplay , M:: MIME , x)
8080 sx = limitstringmime (M, x)
8181 d = Dict (string (M) => sx)
8282 if istextmime (M)
8383 d[" text/plain" ] = sx # directly show text data, e.g. text/csv
8484 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))
8986end
9087
9188# override display to send IPython a dictionary of all supported
9289# output types, so that IPython can choose what to display.
9390function display (d:: InlineDisplay , x)
9491 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))
9993end
10094
10195# we overload redisplay(d, x) to add x to a queue of objects to display,
0 commit comments