Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Dec 20, 2021
1 parent 55e28f3 commit ce2853c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AbstractPlutoDingetjes"
uuid = "6e696c72-6542-2067-7265-42206c756150"
authors = ["Paul Berg <[email protected]>", "Fons van der Plas <[email protected]>"]
version = "1.1.2"
version = "1.1.3"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand Down
49 changes: 26 additions & 23 deletions src/AbstractPlutoDingetjes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ end
See also: [`is_inside_pluto`](@ref).
"""
is_supported_by_display(io::IO, x::Any) = if !_loaded_ref[]
error("`is_supported_by_display` can only be called inside a function, **after** your package has been imported. You can not call the function at top-level.")
else
features = get(io, :pluto_supported_integration_features, [])
x features
end
is_supported_by_display(io::IO, x::Any) =
if !_loaded_ref[]
error("`is_supported_by_display` can only be called inside a function, **after** your package has been imported. You can not call the function at top-level.")
else
features = get(io, :pluto_supported_integration_features, [])
x features
end


"""
Expand All @@ -70,11 +71,12 @@ is_inside_pluto()::Bool
Are we running inside a Pluto notebook?
"""
is_inside_pluto()::Bool = if !_loaded_ref[]
error("`is_inside_pluto` can only be called inside a function, **after** your package has been imported. You can not call the function at top-level.")
else
isdefined(Main, :PlutoRunner)
end
is_inside_pluto()::Bool =
if !_loaded_ref[]
error("`is_inside_pluto` can only be called inside a function, **after** your package has been imported. You can not call the function at top-level.")
else
isdefined(Main, :PlutoRunner)
end
"""
```julia
is_inside_pluto(io::IO)::Bool
Expand All @@ -84,11 +86,12 @@ Are we rendering inside a Pluto notebook?
This function should be used inside a `Base.show` method, and the first argument should be the `io` provided to the `Base.show` method.
"""
is_inside_pluto(io::IO)::Bool = if !_loaded_ref[]
error("`is_inside_pluto` can only be called inside a function, **after** your package has been imported. You can not call the function at top-level.")
else
get(io, :is_pluto, false)
end
is_inside_pluto(io::IO)::Bool =
if !_loaded_ref[]
error("`is_inside_pluto` can only be called inside a function, **after** your package has been imported. You can not call the function at top-level.")
else
get(io, :is_pluto, false)
end


module Bonds
Expand All @@ -114,7 +117,7 @@ Base.show(io::IO, m::MIME"text/html", s::MySlider) = show(io, m, HTML("<input ty
AbstractPlutoDingetjes.Bonds.initial_value(s::MySlider) = first(s.range)
# Add the following for the same functionality on Pluto versions TODO and below. Will be ignored in future Pluto versions. See the compat info below.
# Add the following for the same functionality on Pluto versions 0.17.0 and below. Will be ignored in future Pluto versions. See the compat info below.
Base.get(s::MySlider) = first(s.range)
```
Expand All @@ -123,8 +126,8 @@ Base.get(s::MySlider) = first(s.range)
If you are also using [`transform_value`](@ref) for your widget, then the value returned by `initial_value` should be the value **after** transformation.
!!! compat "Pluto TODO"
This feature only works in Pluto version TODO: NOT RELEASED YET or above.
!!! compat "Pluto 0.17.1"
This feature only works in Pluto version 0.17.1 or above.
Older versions of Pluto used a `Base.get` overload for this (to avoid the need for the `AbstractPlutoDingetjes` package, but we changed our minds 💕). To support all versions of Pluto, use both methods of declaring the initial value.
Expand Down Expand Up @@ -152,8 +155,8 @@ Base.show(io::IO, m::MIME"text/html", s::MyVectorSlider) = show(io, m, HTML("<in
AbstractPlutoDingetjes.Bonds.transform_value(s::MySlider, value_from_javascript::Int) = s.values[value_from_javascript]
```
!!! compat "Pluto TODO"
This feature only works in Pluto version TODO: NOT RELEASED YET or above. Values are not transformed in older versions.
!!! compat "Pluto 0.17.1"
This feature only works in Pluto version 0.17.1 or above. Values are not transformed in older versions.
Use [`AbstractPlutoDingetjes.is_supported_by_display`](@ref) if you want to check support inside your widget.
Expand Down Expand Up @@ -196,8 +199,8 @@ AbstractPlutoDingetjes.Bonds.possible_values(s::MySlider) = AbstractPlutoDingetj
!!! info "Note about `transform_value`"
If you are also using [`transform_value`](@ref) for your widget, then the values returned by `possible_values` should be the values **before** transformation.
!!! compat "Pluto TODO"
This feature only works in Pluto version TODO: NOT RELEASED YET or above.
!!! compat "Pluto 0.17.3"
This feature only works in Pluto version 0.17.3 or above.
"""
possible_values(bond::Any) = NotGiven()
Expand Down

2 comments on commit ce2853c

@fonsp
Copy link
Member Author

@fonsp fonsp commented on ce2853c Dec 20, 2021

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@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/50879

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 v1.1.3 -m "<description of version>" ce2853c9f9930d14a2ddd4ce01f46d4061c0fbfa
git push origin v1.1.3

Please sign in to comment.