diff --git a/docs/make.jl b/docs/make.jl index 510496b..7fde57c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,30 +9,28 @@ function Base.show(io::IO, m::MIME"text/html", v::Vega.VGSpec) end makedocs( - modules=[Vega], - sitename="Vega.jl", - pages=[ - "Home" => "index.md", - "Getting Started" => Any[ - "Installation" => "gettingstarted/installation.md" - ], - "User Guide" => Any[ - "Using Vega" => "userguide/vega.md" - ], - "Examples" => Any[ - - "Line & Area Charts" => "examples/examples_vega_line_area_charts.md", - "Circular Charts" => "examples/examples_vega_circular_charts.md", - "Scatter Plots" => "examples/examples_vega_scatter_plots.md", - "Tree Diagrams" => "examples/examples_vega_tree_diagrams.md", - "Network Diagrams" => "examples/examples_vega_network_diagrams.md", - "Single Data Source" => "examples/examples_vega_single_data_source.md", - "Multiple Data Source" => "examples/examples_vega_multi_data_source.md" - ], - "Reference Manual" => [ - "Global settings" => "referencemanual/global.md", - "Outputs" => "referencemanual/output.md"] - ] + modules=[Vega], + sitename="Vega.jl", + pages=[ + "Home" => "index.md", + "Getting Started" => Any[ + "Installation"=>"gettingstarted/installation.md" + ], + "User Guide" => Any[ + "Using Vega"=>"userguide/vega.md" + ], + "Examples" => Any["Line & Area Charts"=>"examples/examples_vega_line_area_charts.md", + "Circular Charts"=>"examples/examples_vega_circular_charts.md", + "Scatter Plots"=>"examples/examples_vega_scatter_plots.md", + "Tree Diagrams"=>"examples/examples_vega_tree_diagrams.md", + "Network Diagrams"=>"examples/examples_vega_network_diagrams.md", + "Single Data Source"=>"examples/examples_vega_single_data_source.md", + "Multiple Data Source"=>"examples/examples_vega_multi_data_source.md" + ], + "Reference Manual" => [ + "Global settings" => "referencemanual/global.md", + "Outputs" => "referencemanual/output.md"] + ] ) deploydocs( diff --git a/src/Vega.jl b/src/Vega.jl index 4e99f77..2cba87f 100644 --- a/src/Vega.jl +++ b/src/Vega.jl @@ -68,7 +68,7 @@ show if plots will have (true) or not (false) the action links displayed indicate if actions links should be dislpayed under the plot """ actionlinks() = ACTIONSLINKS -actionlinks(b::Bool) = (global ACTIONSLINKS ; ACTIONSLINKS = b) +actionlinks(b::Bool) = (global ACTIONSLINKS; ACTIONSLINKS = b) ######################## includes ##################################### diff --git a/src/dsl_vlplot_function/dsl_vlplot_function.jl b/src/dsl_vlplot_function/dsl_vlplot_function.jl index 7dc45b3..36b7603 100644 --- a/src/dsl_vlplot_function/dsl_vlplot_function.jl +++ b/src/dsl_vlplot_function/dsl_vlplot_function.jl @@ -19,7 +19,7 @@ function convert_nt_to_dict(item::AbstractVegaFragment, fragtype) return fragtype(item.positional, OrderedDict{String,Any}(string(k) => convert_nt_to_dict(v, fragtype) for (k, v) in pairs(item.named))) end -function walk_dict(f, d::T, parent) where {T <: AbstractDict} +function walk_dict(f, d::T, parent) where {T<:AbstractDict} res = T() for p in d if p[2] isa Dict @@ -108,6 +108,6 @@ function convert_frag_tree_to_dict(spec::VGFrag) return OrderedDict{String,Any}(k => replace_remaining_frag(v) for (k, v) in spec.named) end -function vgplot(args...;kwargs...) - return VGSpec(convert_frag_tree_to_dict(fix_shortcut_level_spec(vgfrag(args...;kwargs...)))) +function vgplot(args...; kwargs...) + return VGSpec(convert_frag_tree_to_dict(fix_shortcut_level_spec(vgfrag(args...; kwargs...)))) end diff --git a/src/dsl_vlplot_macro/dsl_vlplot_macro.jl b/src/dsl_vlplot_macro/dsl_vlplot_macro.jl index 27f12d3..719396d 100644 --- a/src/dsl_vlplot_macro/dsl_vlplot_macro.jl +++ b/src/dsl_vlplot_macro/dsl_vlplot_macro.jl @@ -3,7 +3,7 @@ function convert_curly_style_array(exprs, fragtype) for ex in exprs if ex isa Expr && ex.head == :braces - push!(res.args, :( $(convert_curly_style(ex.args, fragtype)) )) + push!(res.args, :($(convert_curly_style(ex.args, fragtype)))) else push!(res.args, esc(ex)) end @@ -21,11 +21,11 @@ function convert_curly_style(exprs, fragtype) for ex in exprs if ex isa Expr && ex.head == :(=) if ex.args[2] isa Expr && ex.args[2].head == :braces - push!(named_args, :( $(string(ex.args[1])) => $(convert_curly_style(ex.args[2].args, fragtype)) )) + push!(named_args, :($(string(ex.args[1])) => $(convert_curly_style(ex.args[2].args, fragtype)))) elseif ex.args[2] isa Expr && ex.args[2].head == :vect - push!(named_args, :( $(string(ex.args[1])) => $(convert_curly_style_array(ex.args[2].args, fragtype)) )) + push!(named_args, :($(string(ex.args[1])) => $(convert_curly_style_array(ex.args[2].args, fragtype)))) else - push!(named_args, :( $(string(ex.args[1])) => $(esc(ex.args[2])) )) + push!(named_args, :($(string(ex.args[1])) => $(esc(ex.args[2])))) end elseif ex isa Expr && ex.head == :braces push!(pos_args, convert_curly_style(ex.args, fragtype)) @@ -40,7 +40,7 @@ end macro vgplot(ex...) new_ex = convert_curly_style(ex, VGFrag) - return :( Vega.VGSpec(convert_frag_tree_to_dict(fix_shortcut_level_spec($new_ex))) ) + return :(Vega.VGSpec(convert_frag_tree_to_dict(fix_shortcut_level_spec($new_ex)))) end macro vgfrag(ex...) diff --git a/src/rendering/io.jl b/src/rendering/io.jl index 10b3cb7..2ae688c 100644 --- a/src/rendering/io.jl +++ b/src/rendering/io.jl @@ -40,5 +40,5 @@ end savespec(filename::AbstractString, v::AbstractVegaSpec; kwargs...) = open(filename, "w") do io - savespec(io, v; kwargs...) -end + savespec(io, v; kwargs...) + end diff --git a/src/rendering/render.jl b/src/rendering/render.jl index 12e169b..612f368 100644 --- a/src/rendering/render.jl +++ b/src/rendering/render.jl @@ -7,14 +7,14 @@ using JSON asset(url...) = normpath(vegalite_app_path("minified", url...)) -const package_json = Ref{Dict{String, Any}}() +const package_json = Ref{Dict{String,Any}}() function version(package) - if !isassigned(package_json) - package_json[] = JSON.parsefile(vegalite_app_path("package.json")) - end + if !isassigned(package_json) + package_json[] = JSON.parsefile(vegalite_app_path("package.json")) + end - return package_json[]["dependencies"][package] + return package_json[]["dependencies"][package] end # Vega Scaffold: https://github.com/vega/vega/wiki/Runtime @@ -23,47 +23,50 @@ function writehtml_full(io::IO, spec::VGSpec; title="Vega plot") divid = "vg" * randstring(3) println(io, - """ - -
-