Skip to content

Commit

Permalink
Make Dump lazy to respect IOContext of displayer
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Mar 11, 2021
1 parent 31decdc commit 2362efb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlutoUI"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
authors = ["Fons van der Plas <[email protected]>"]
version = "0.7.2"
version = "0.7.3"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
14 changes: 10 additions & 4 deletions src/DisplayTricks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ This is a variant of [`Base.dump`](@ref) that returns the representation directl
See also: [`Print`](@ref) and [`with_terminal`](@ref).
"""
function Dump(x; maxdepth=8)
sprint() do io
dump(io, x; maxdepth=maxdepth)
end |> Text
struct Dump
x::Any
maxdepth::Integer
end

Dump(x; maxdepth=8) = Dump(x, maxdepth)

function Base.show(io::IO, ::MIME"text/plain", d::Dump)
dump(io, d.x; maxdepth=d.maxdepth)
end


"""
Show(mime::MIME, data)
Expand Down

2 comments on commit 2362efb

@fonsp
Copy link
Member Author

@fonsp fonsp commented on 2362efb Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/31754

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.3 -m "<description of version>" 2362efbbaf2db5796862ebbfe8e7e8a89bb1265e
git push origin v0.7.3

Please sign in to comment.