@@ -4,7 +4,7 @@ module Multimedia
44
55export  AbstractDisplay, display, pushdisplay, popdisplay, displayable, redisplay,
66    MIME, @MIME_str , istextmime,
7-     mimewritable , TextDisplay
7+     showable , TextDisplay
88
99# ##########################################################################
1010#  We define a singleton type MIME{mime symbol} for each MIME type, so
@@ -25,23 +25,26 @@ print(io::IO, ::MIME{mime}) where {mime} = print(io, mime)
2525#  in order to provide a way to export T as a given mime type.
2626
2727""" 
28-     mimewritable (mime, x) 
28+     showable (mime, x) 
2929
30- Returns a boolean value indicating whether or not the object `x` can be written as the given 
31- `mime` type. (By default, this is determined automatically by the existence of the 
32- corresponding [`show`](@ref) method for `typeof(x)`.) 
30+ Returns a boolean value indicating whether or not the object `x` can be written 
31+ as the given `mime` type. 
32+ 
33+ (By default, this is determined automatically by the existence of the 
34+ corresponding [`show`](@ref) method for `typeof(x)`.  Some types provide custom `showable` 
35+ methods; for example, if the available MIME formats depend on the *value* of `x`.) 
3336
3437# Examples 
3538```jldoctest 
36- julia> mimewritable (MIME("text/plain"), rand(5)) 
39+ julia> showable (MIME("text/plain"), rand(5)) 
3740true 
3841
39- julia> mimewritable(MIME( "img/png") , rand(5)) 
42+ julia> showable( "img/png", rand(5)) 
4043false 
4144``` 
4245""" 
43- mimewritable (:: MIME{mime} , x) where  {mime} = 
44-      hasmethod (show, Tuple{IO,  MIME{mime},  typeof (x)} )
46+ showable (:: MIME{mime} , x) where  {mime} =   hasmethod (show, Tuple{IO, MIME{mime},  typeof (x)}) 
47+ showable (m :: AbstractString , x)  =   showable ( MIME (m), x )
4548
4649""" 
4750    show(io, mime, x) 
@@ -73,10 +76,7 @@ The first argument to `show` can be an [`IOContext`](@ref) specifying output for
7376See [`IOContext`](@ref) for details. 
7477""" 
7578show (stream, mime, x)
76- 
77- #  it is convenient to accept strings instead of ::MIME
7879show (io:: IO , m:: AbstractString , x) =  show (io, MIME (m), x)
79- mimewritable (m:: AbstractString , x) =  mimewritable (MIME (m), x)
8080
8181""" 
8282    repr(mime, x; context=nothing) 
0 commit comments