#325 docs: add example for using printrepr

Open Mary McGrath mcmcgrath13 Pseudo commit used to compare (6b89f19...0b3d0fa)

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.


@@ -13,3 +13,17 @@
Loading
13 13
function fileio_save(stream::FileIO.Stream{FileIO.format"vegalite"}, data::VLSpec; include_data=true, kwargs...)
14 14
    Vega.savespec(stream.io, data; include_data=include_data, kwargs...)
15 15
end
16 +
17 +
function fileio_save(file::FileIO.File{FileIO.format"vega"}, data::VLSpec; include_data=true, kwargs...)
18 +
    s = Base64.stringmime(MIME("application/vnd.vega.v5+json"), data)
19 +
    parsed = JSON.parse(s)
20 +
    vgspec = Vega.VGSpec(parsed)
21 +
    Vega.savespec(file.filename, vgspec; include_data=include_data, kwargs...)
22 +
end
23 +
24 +
function fileio_save(stream::FileIO.Stream{FileIO.format"vega"}, data::VLSpec; include_data=true, kwargs...)
25 +
    s = Base64.stringmime(MIME("application/vnd.vega.v5+json"), data)
26 +
    parsed = JSON.parse(s)
27 +
    vgspec = Vega.VGSpec(parsed)
28 +
    Vega.savespec(stream.io, vgspec; include_data=include_data, kwargs...)
29 +
end

@@ -17,6 +17,7 @@
Loading
17 17
using DataStructures
18 18
import TableTraitsUtils
19 19
using Vega
20 +
import Base64
20 21
21 22
export renderer, actionlinks
22 23
export @vl_str, @vlplot, vlplot, @vlfrag, vlfrag

@@ -70,3 +70,15 @@
Loading
70 70
function eps(filename::AbstractString, v::VLSpec)
71 71
    savefig(filename, "application/eps", v)
72 72
end
73 +
74 +
function Vega.savespec(io::IO, v::VLSpec; include_data=false, indent=nothing)
75 +
    output_dict = copy(Vega.getparams(v))
76 +
    if !include_data
77 +
        delete!(output_dict, "data")
78 +
    end
79 +
    if indent === nothing
80 +
        JSON.print(io, output_dict)
81 +
    else
82 +
        JSON.print(io, output_dict, indent)
83 +
    end
84 +
end

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
src -0.79% 76.42%
Project Totals (12 files) 76.42%
Loading