Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #12872, rename istext to istextmime #15708

Merged
merged 1 commit into from
Apr 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -8182,7 +8182,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 @@ -10160,11 +10160,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