Skip to content

Commit

Permalink
Merge pull request #15708 from JuliaLang/jb/istext
Browse files Browse the repository at this point in the history
fix #12872, rename `istext` to `istextmime`
  • Loading branch information
JeffBezanson committed Apr 8, 2016
2 parents 47c29a9 + 861be19 commit 839f8c9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1002,3 +1002,6 @@ export call

# 1933
@deprecate_binding SingleAsyncWork AsyncCondition

# #12872
@deprecate istext istextmime
6 changes: 3 additions & 3 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8135,7 +8135,7 @@ Returns an `AbstractString` or `Vector{UInt8}` containing the representation of
requested `mime` type, as written by `writemime` (throwing a `MethodError` if no appropriate
`writemime` is available). An `AbstractString` is returned for MIME types with textual
representations (such as `"text/html"` or `"application/postscript"`), whereas binary data
is returned as `Vector{UInt8}`. (The function `istext(mime)` returns whether or not Julia
is returned as `Vector{UInt8}`. (The function `istextmime(mime)` returns whether or not Julia
treats a given `mime` type as text.)
As a special case, if `x` is an `AbstractString` (for textual MIME types) or a
Expand Down Expand Up @@ -10095,11 +10095,11 @@ processes completed successfully.
exit

"""
istext(m::MIME)
istextmime(m::MIME)
Determine whether a MIME type is text data.
"""
istext
istextmime

"""
merge!(collection, others...)
Expand Down
2 changes: 1 addition & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ export
display,
displayable,
TextDisplay,
istext,
istextmime,
MIME,
@MIME,
@MIME_str,
Expand Down
10 changes: 5 additions & 5 deletions base/multimedia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Multimedia

export Display, display, pushdisplay, popdisplay, displayable, redisplay,
MIME, @MIME, @MIME_str, writemime, reprmime, stringmime, istext,
MIME, @MIME, @MIME_str, writemime, reprmime, stringmime, istextmime,
mimewritable, TextDisplay

###########################################################################
Expand Down Expand Up @@ -45,7 +45,7 @@ mimewritable(m::AbstractString, x) = mimewritable(MIME(m), x)

###########################################################################
# MIME types are assumed to be binary data except for a set of types known
# to be text data (possibly Unicode). istext(m) returns whether
# to be text data (possibly Unicode). istextmime(m) returns whether
# m::MIME is text data, and reprmime(m, x) returns x written to either
# a string (for text m::MIME) or a Vector{UInt8} (for binary m::MIME),
# assuming the corresponding write_mime method exists. stringmime
Expand All @@ -65,7 +65,7 @@ macro textmime(mime)
Base.Multimedia.reprmime(m::mimeT, x::Vector{UInt8}) = sprint(writemime, m, x)
Base.Multimedia.stringmime(m::mimeT, x::Vector{UInt8}) = reprmime(m, x)

Base.Multimedia.istext(::mimeT) = true
Base.Multimedia.istextmime(::mimeT) = true
if $(mime != "text/plain") # strings are shown escaped for text/plain
Base.Multimedia.reprmime(m::mimeT, x::AbstractString) = x
end
Expand All @@ -74,7 +74,7 @@ macro textmime(mime)
end
end

istext(::MIME) = false
istextmime(::MIME) = false
function reprmime(m::MIME, x)
s = IOBuffer()
writemime(s, m, x)
Expand All @@ -85,7 +85,7 @@ stringmime(m::MIME, x) = base64encode(writemime, m, x)
stringmime(m::MIME, x::Vector{UInt8}) = base64encode(write, x)

# it is convenient to accept strings instead of ::MIME
istext(m::AbstractString) = istext(MIME(m))
istextmime(m::AbstractString) = istextmime(MIME(m))
reprmime(m::AbstractString, x) = reprmime(MIME(m), x)
stringmime(m::AbstractString, x) = stringmime(MIME(m), x)

Expand Down

0 comments on commit 839f8c9

Please sign in to comment.