Implemented show(io::IO, ::MIME"text/html" method
This commit is contained in:
parent
bad5e12681
commit
b79228d7b1
@ -202,6 +202,7 @@ Structure containing the package global options, accessible through `Gnuplot.opt
|
|||||||
- `cmd::String`: command to start the Gnuplot process (default: `"gnuplot"`)
|
- `cmd::String`: command to start the Gnuplot process (default: `"gnuplot"`)
|
||||||
- `default::Symbol`: default session name (default: `:default`)
|
- `default::Symbol`: default session name (default: `:default`)
|
||||||
- `term::String`: default terminal for interactive use (default: empty string, i.e. use gnuplot settings);
|
- `term::String`: default terminal for interactive use (default: empty string, i.e. use gnuplot settings);
|
||||||
|
- `term_html::String`: terminal to save HTML files (default `"canvas mousing`);
|
||||||
- `term_svg::String`: terminal to save png files (default `"svg background rgb 'white' dynamic"`);
|
- `term_svg::String`: terminal to save png files (default `"svg background rgb 'white' dynamic"`);
|
||||||
- `term_png::String`: terminal to save png files (default `"pngcairo"`);
|
- `term_png::String`: terminal to save png files (default `"pngcairo"`);
|
||||||
- `init::Vector{String}`: commands to initialize the session when it is created or reset (e.g., to set default palette);
|
- `init::Vector{String}`: commands to initialize the session when it is created or reset (e.g., to set default palette);
|
||||||
@ -216,6 +217,7 @@ Base.@kwdef mutable struct Options
|
|||||||
cmd::String = "gnuplot"
|
cmd::String = "gnuplot"
|
||||||
default::Symbol = :default
|
default::Symbol = :default
|
||||||
term::String = ""
|
term::String = ""
|
||||||
|
term_html::String = "canvas mousing"
|
||||||
term_svg::String = "svg background rgb 'white' dynamic"
|
term_svg::String = "svg background rgb 'white' dynamic"
|
||||||
term_png::String = "pngcairo"
|
term_png::String = "pngcairo"
|
||||||
init::Vector{String} = Vector{String}()
|
init::Vector{String} = Vector{String}()
|
||||||
@ -1535,6 +1537,15 @@ function Base.show(io::IO, ::MIME"image/png", gp::SessionID)
|
|||||||
end
|
end
|
||||||
nothing
|
nothing
|
||||||
end
|
end
|
||||||
|
function Base.show(io::IO, ::MIME"text/html", gp::SessionID)
|
||||||
|
if gp.dump
|
||||||
|
tmpfile = tempname()*".png"
|
||||||
|
save(gp.sid; term=options.term_html, output=tmpfile)
|
||||||
|
write(io, read(tmpfile))
|
||||||
|
rm(tmpfile; force=true)
|
||||||
|
end
|
||||||
|
nothing
|
||||||
|
end
|
||||||
|
|
||||||
# ╭───────────────────────────────────────────────────────────────────╮
|
# ╭───────────────────────────────────────────────────────────────────╮
|
||||||
# │ HIGH LEVEL FACILITIES │
|
# │ HIGH LEVEL FACILITIES │
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user