Skip to content

Commit

Permalink
Provide three-argument show (JuliaLang#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
TotalVerb authored and dpsanders committed Feb 1, 2017
1 parent 49a7a81 commit 93586cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `print_escaped` is now another method of `escape_string`, `print_unescaped` a method of `unescape_string`, and `print_joined` a method of `join`. [#16603](https://github.com/JuliaLang/julia/pull/16603)

* `writemime` has been merged into `show` [#16563](https://github.com/JuliaLang/julia/pull/16563). Note that to extend this function requires `@compat`; see the [Supported Syntax](#supported-syntax) section for more information.

## New macros

* `@static` has been added [#16219](https://github.com/JuliaLang/julia/pull/16219).
Expand Down
4 changes: 4 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1438,4 +1438,8 @@ if VERSION < v"0.5.0-dev+4351"
print_escaped(io, str, esc)
end

if VERSION < v"0.5.0-dev+4340"
Base.show(io::IO, mime, x) = writemime(io, mime, x)
end

end # module
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1344,3 +1344,6 @@ end
@test sprint(join, [1, 2, 3], ", ", ", and ") == "1, 2, and 3"
@test sprint(escape_string, "xyz\n", "z") == "xy\\z\\n"
@test sprint(unescape_string, "xyz\\n") == "xyz\n"

# three-argument show from JuliaLang/julia#16563
@test sprint(show, "text/plain", 1) == stringmime("text/plain", 1)

0 comments on commit 93586cd

Please sign in to comment.