mirror of https://github.com/mpastell/Weave.jl
limit display:
- for now if we try to render a "big object" like a table with many rows, Weave tries to render all of the result and it can lead to that a document can't even be openedpull/311/head
parent
58bc741b7f
commit
7b53eb8e9e
|
@ -83,10 +83,10 @@ Base.display(report::Report, m::MIME"image/svg+xml", data) = add_figure(report,
|
|||
|
||||
Base.display(report::Report, m::MIME"application/pdf", data) = add_figure(report, data, m, ".pdf")
|
||||
|
||||
#Text is written to stdout, called from "term" mode chunks
|
||||
# Text is written to stdout, called from "term" mode chunks
|
||||
function Base.display(report::Report, m::MIME"text/plain", data)
|
||||
io = PipeBuffer()
|
||||
show(IOContext(io, :limit => true), m, data)
|
||||
show(IOContext(io, :limit => true, :color => true), m, data)
|
||||
flush(io)
|
||||
s = read(io, String)
|
||||
close(io)
|
||||
|
@ -107,13 +107,14 @@ function Base.show(io, m::MIME"text/html", data::Exception)
|
|||
println(io, "</pre>")
|
||||
end
|
||||
|
||||
#Catch "rich_output"
|
||||
# Catch "rich_output"
|
||||
function Base.display(report::Report, m::MIME"text/html", data)
|
||||
s = repr(m, data)
|
||||
report.rich_output *= "\n" * s
|
||||
io = IOBuffer()
|
||||
show(IOContext(io, :limit => true, :color => true), m, data)
|
||||
report.rich_output *= "\n" * String(take!(io))
|
||||
end
|
||||
|
||||
#Catch "rich_output"
|
||||
# Catch "rich_output"
|
||||
function Base.display(report::Report, m::MIME"text/markdown", data)
|
||||
s = repr(m, data)
|
||||
# Convert to "richer" type of possible
|
||||
|
|
Loading…
Reference in New Issue