You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/runner/PlutoRunner/src/bonds.jl
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ function transform_bond_value(s::Symbol, value_from_js)
10
10
catch e
11
11
@error"🚨 AbstractPlutoDingetjes: Bond value transformation errored." exception=(e, catch_backtrace())
12
12
(;
13
-
message=Text("🚨 AbstractPlutoDingetjes: Bond value transformation errored."),
13
+
message=Text("🚨 AbstractPlutoDingetjes: Bond value transformation errored."),
14
14
exception=Text(
15
15
sprint(showerror, e, stacktrace(catch_backtrace()))
16
16
),
@@ -35,16 +35,16 @@ function possible_bond_values(s::Symbol; get_length::Bool=false)
35
35
:InfinitePossibilities
36
36
elseif (possible_values isa AbstractPlutoDingetjes.Bonds.NotGiven)
37
37
# error("Bond \"$s\" did not specify its possible values with `AbstractPlutoDingetjes.Bond.possible_values()`. Try using PlutoUI for the `@bind` values.")
38
-
38
+
39
39
# If you change this, change it everywhere in this file.
40
40
:NotGiven
41
41
else
42
-
get_length ?
42
+
get_length ?
43
43
try
44
44
length(possible_values)
45
45
catch
46
46
length(make_serializable(possible_values))
47
-
end:
47
+
end:
48
48
make_serializable(possible_values)
49
49
end
50
50
end
@@ -118,7 +118,7 @@ x^2
118
118
The first cell will show a slider as the cell's output, ranging from 0 until 100.
119
119
The second cell will show the square of `x`, and is updated in real-time as the slider is moved.
120
120
"""
121
-
macrobind(def, element)
121
+
macrobind(def, element)
122
122
if def isa Symbol
123
123
quote
124
124
$(load_integrations_if_needed)()
@@ -133,13 +133,16 @@ end
133
133
134
134
"""
135
135
Will be inserted in saved notebooks that use the @bind macro, make sure that they still contain legal syntax when executed as a vanilla Julia script. Overloading `Base.get` for custom UI objects gives bound variables a sensible value.
136
+
Also turns off JuliaFormatter formatting to avoid issues with the formatter trying to change code that the user does not control. See https://domluna.github.io/JuliaFormatter.jl/stable/#Turn-off/on-formatting
136
137
"""
137
138
const fake_bind ="""macro bind(def, element)
139
+
#! format: off
138
140
quote
139
141
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
140
142
local el = \$(esc(element))
141
143
global \$(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
0 commit comments