Skip to content
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
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name = "InferenceObjects"
uuid = "b5cf5a8d-e756-4ee3-b014-01d49d192c00"
authors = ["Seth Axen <[email protected]> and contributors"]
version = "0.4.10"
version = "0.4.11"

[deps]
ANSIColoredPrinters = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -21,6 +22,7 @@ InferenceObjectsNCDatasetsExt = "NCDatasets"
InferenceObjectsPosteriorStatsExt = ["PosteriorStats", "StatsBase"]

[compat]
ANSIColoredPrinters = "0.0.1"
ArviZExampleData = "0.1.10"
Dates = "1.9"
DimensionalData = "0.27, 0.28, 0.29"
Expand Down
1 change: 1 addition & 0 deletions src/InferenceObjects.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module InferenceObjects

using ANSIColoredPrinters: ANSIColoredPrinters
using Dates: Dates
using DimensionalData: DimensionalData, Dimensions, LookupArrays
using Random: Random
Expand Down
9 changes: 8 additions & 1 deletion src/inference_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,20 @@ function Base.show(io::IO, ::MIME"text/plain", data::InferenceData)
end
function Base.show(io::IO, mime::MIME"text/html", data::InferenceData)
show(io, mime, HTML("<div>InferenceData"))
io_ansicolor = IOBuffer()
ctx = IOContext(io_ansicolor, :compact => true, :color => true)
for (name, group) in pairs(groups(data))
show(ctx, MIME"text/plain"(), group)
printer = ANSIColoredPrinters.HTMLPrinter(io_ansicolor)
show(io, mime, HTML("""
<details>
<summary>$name</summary>
<pre><code>$(sprint(show, "text/plain", group))</code></pre>
"""))
show(io, mime, printer)
show(io, mime, HTML("""
</details>
"""))
take!(io_ansicolor) # reset the buffer
end
return show(io, mime, HTML("</div>"))
end
Expand Down
Loading