Skip to content

Commit

Permalink
fix #51
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Dec 8, 2024
1 parent 4d5604b commit accb03d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlotlyLight"
uuid = "ca7969ec-10b3-423e-8d99-40f33abb42bf"
authors = ["joshday <[email protected]>"]
version = "0.11.0"
version = "0.11.1"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand All @@ -10,6 +10,7 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
EasyConfig = "acab07b0-f158-46d4-8913-50acef6d41fe"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[compat]
Expand All @@ -20,6 +21,7 @@ Dates = "1.11.0"
Downloads = "1.6"
EasyConfig = "0.1"
JSON3 = "1.14"
REPL = "1.11.0"
julia = "1.7"

[extras]
Expand Down
15 changes: 5 additions & 10 deletions src/PlotlyLight.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using Artifacts: @artifact_str
using Downloads: download
using Random: randstring
using Dates
using REPL: REPLDisplay

using JSON3: JSON3
using EasyConfig: Config
Expand All @@ -13,15 +14,6 @@ using Cobweb: Cobweb, h, IFrame, Node
export Config, preset, Plot, plot

#-----------------------------------------------------------------------------# __init__
function __init__()
# Hack since extensions with REPL are wonky
for M in Base.loaded_modules_order
if Symbol(M) == :REPL
@eval Base.display(::$M.REPLDisplay, o::Plot) = Cobweb.preview(html_page(o))
end
end
end

include("json.jl")

artifact(x...) = joinpath(artifact"plotly_artifacts", x...)
Expand Down Expand Up @@ -133,7 +125,7 @@ end
rand_id() = "plotlyx-" * join(rand('a':'z', 10))

function html_div(o::Plot, id=rand_id())
h.div(class="plotlylight-parent", settings.src, settings.src_inject..., settings.div(; id), NewPlotScript(o, settings, id))
h.div(class="plotlylight-parent", settings.src_inject..., settings.src, settings.div(; id), NewPlotScript(o, settings, id))
end

function html_page(o::Plot, id=rand_id())
Expand Down Expand Up @@ -165,6 +157,9 @@ function Base.show(io::IO, ::MIME"text/html", o::Plot)
end
Base.show(io::IO, ::MIME"juliavscode/html", o) = show(io, MIME("text/html"), o)

Base.display(::REPLDisplay, o::Plot) = Cobweb.preview(html_page(o), reuse=settings.reuse_preview)


#-----------------------------------------------------------------------------# preset
# `preset_template_<X>` overwrites `settings.layout.template`
# `preset_src_<X>` overwrites `settings.src`
Expand Down
7 changes: 1 addition & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using PlotlyLight
using PlotlyLight, Cobweb, Test, Aqua, Dates, JSON3
using PlotlyLight: settings, Plot, json
using Cobweb
using Cobweb: h
using JSON3: JSON3
using Test
using Aqua

html(x) = repr("text/html", x)

Expand Down

2 comments on commit accb03d

@joshday
Copy link
Member Author

@joshday joshday commented on accb03d Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/120958

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.1 -m "<description of version>" accb03dda8d6b2faeac75178b4aad105c9c7c70f
git push origin v0.11.1

Please sign in to comment.