JolinPluto

API documentation for JolinPluto.

JolinPluto.NoPut — Constant
NoPut

Special singleton value. It is used inside ChannelWithRepeatedFill to indicate that a specific repetition should not add any value to the Channel.

source
JolinPluto.Setter — Type
Setter()
Setter("initial_value")

Creates a pluto interactivity which separates the setter cell from the state cell.

Usage

set_a = Setter("initial_value")

# in another cell, extract the inner state from the setter
# such that updates will rerun this cell
a = @get set_a

# in yet another cell use `set_a`
set_a("new_value")

# or use a function syntax to easily access the previous value
set_a() do prev_a
    "$prev_a!!"
end
source
Base.get — Method
get(setter::Setter)

Only works inside Jolin Pluto Notebook. Extracts the value from the Setter wrapper, making this very cell reactive so that as soon as the setter is called, this cell will rerun.

source
JolinPluto.ChannelPluto — Method
channel = ChannelPluto(10) do ch
    for i in 1:10
        put!(ch, i)
        sleep(1)
    end
end

Like normal Channel, with the underlying task being interrupted as soon as the Pluto cell is deleted.

source
JolinPluto.ChannelWithRepeatedFill — Method
ChannelWithRepeatedFill(get_next_value, 2; sleep_seconds=1.0)

Creates a ChannelPluto which calls get_next_value repeatedly, interleaved by calls to sleep of the given time (defaults to 0 seconds sleep).

source
JolinPluto.MD — Method
MD("# Markdown String")

Markdown parser with special support for inline html fenced by <>...</>. As format_html returns single line html, this makes it possible to interpolate arbitrary html into markdown tables.

source
JolinPluto.authenticate_token — Function
authenticate_token()
authenticate_token("exampleaudience")

Creates a JSON Web Token which can be used for authentication at common cloud providers.

On cloud.jolin.io the token will be issued and signed by cloud.jolin.io, on Github Actions (used for automated tests), a respective github token is returned.

source
JolinPluto.cell_ids_create_wrapper — Method
cell_ids_wrapper = cell_ids_create_wrapper()

Creates a wrapper around a Set of cell_ids so that they can be added (and removed) seamlessly and automatically from other cells.

Usage

cell_ids_wrapper = cell_ids_create_wrapper()

# in another cell access the cellids and e.g. print the url suffix
cell_ids = get(cell_ids_wrapper)
print(join("&isolated_cell_id=$id" for id in cell_ids))

# in yet another cell add its cell_id
cell_ids_push!(cell_ids_wrapper)
source
JolinPluto.cell_ids_push! — Method
cell_ids_push!(cell_ids_wrapper)

Adds the cell's cell-id to the given cellidswrapper. This automatically handles retriggering of cells as needed.

Also cleanup is handled, i.e. that the cell-id is removed again if this cell is deleted.

source
JolinPluto.clipboard_image_to_clipboard_html — Method

clipboardimagetoclipboardhtml()

Creates a little textfield where you can paste images. These images are then transformed to self-containing html img tags and copied back to the clipboard to be entered somewhere in Pluto.

source
JolinPluto.embedLargeHTML — Method
embedLargeHTML(html_string; width, height)

For large HTML code a simple iframe is not enough. This function will help.

Example

JolinPluto.embedLargeHTML(read("figure.html", String); width="100%", height=400)
source
JolinPluto.format_html — Method
format_html(anything)

Transform an object to raw html respresentation.

Note, this is a single line representation so that it can also be used inside Markdown Tables.

source
JolinPluto.is_running_in_jolinpluto_process — Method
is_running_in_pluto_process()

This doesn't mean we're in a Pluto cell, e.g. can use @bind and hooks goodies. It only means PlutoRunner is available (and at a version that technically supports hooks)

source
JolinPluto.is_running_in_pluto_process — Method
is_running_in_pluto_process()

This doesn't mean we're in a Pluto cell, e.g. can use @bind and hooks goodies. It only means PlutoRunner is available (and at a version that technically supports hooks)

source
JolinPluto.output_below — Method
output_below()

Reverse input output, first input then output. When removing the cell with @output_below, the order is reversed again.

source
JolinPluto.repeat_at — Method
repeat_at(t -> (rand(), t), ceil(now(), Second(10)), init=:wait)

repeat_at(ceil(now(), Second(10)), init=:wait) do t
	# code to be returned repeatedly
	rand(), t
end

When run inside Pluto it will rerun the function on the next specified time, again and again.

Keyword Arguments

  • init specifies what to do at first run or re-evaluation caused by standard reactivity. You can specify any function (e.g. init=myinit_func)or one of the two special values :wait und :run. :wait (default) will wait for the next time and then run the code. :run will run the code immediately without waiting.
source
JolinPluto.repeat_run — Function
repeat_run(function_used_for_init_and_repeated_execution)
repeat_run(function_for_init, function_for_repetition)

Repeat some long expression. It will run offline in a separate Task so that interactivity is preserved.

Optionally, specify another expression for initialization. Initialization will also be triggered if the cell is re-evaluated because some dependent cell or bond changed.

source
JolinPluto.repeat_take! — Method
nextvalue = repeat_take!(channel)

This will repeatedly fetch for the next element from the given channel, re-evaluating the cell each time a new value arrives.

source
JolinPluto.viewof — Method
viewof(:symbol, element)
viewof("symbol", element)

Return the HTML element, and use its latest JavaScript value as the definition of symbol.

Example

viewof(:x, html"<input type=range>")

and in another cell:

x^2

The first cell will show a slider as the cell's output, ranging from 0 until 100. The second cell will show the square of x, and is updated in real-time as the slider is moved.

source
JolinPluto.@Channel — Macro
channel = @Channel(10) do ch
    for i in 1:10
        put!(ch, i)
        sleep(1)
    end
end

Like normal Channel, with the underlying task being interrupted as soon as the Pluto cell is deleted.

source
JolinPluto.@cell_ids_create_wrapper — Macro
cell_ids_wrapper = @cell_ids_create_wrapper()

Creates a wrapper around a Set of cell_ids so that they can be added (and removed) seamlessly and automatically from other cells.

Usage

cell_ids_wrapper = @cell_ids_create_wrapper()

# in another cell access the cellids and e.g. print the url suffix
cell_ids = @get cell_ids_wrapper
print(join("&isolated_cell_id=$id" for id in cell_ids))

# in yet another cell add its cell_id
@cell_ids_push! cell_ids_wrapper
source
JolinPluto.@cell_ids_push! — Macro
@cell_ids_push! cell_ids_wrapper

Adds the cell's cell-id to the given cellidswrapper. This automatically handles retriggering of cells as needed.

Also cleanup is handled, i.e. that the cell-id is removed again if this cell is deleted.

source
JolinPluto.@get — Macro
@get setter

Extracts the value from the Setter wrapper, making this very cell reactive so that as soon as the setter is called, this cell will rerun.

source
JolinPluto.@repeat_at — Macro
@repeat_at(ceil(now(), Second(10)), init=:wait) do t
	# code to be returned repeatedly
	rand(), t
end

@repeat_at(ceil(now(), Second(10)), init=:wait)

When run inside Pluto it will rerun the function on the next specified time, again and again.

Keyword Arguments

  • init specifies what to do at first run or re-evaluation caused by standard reactivity. You can specify any code or function call (e.g. init=nothing, or init=myinit()). In addition there are two special values :wait und :run. :wait (default) will wait for the next time and then run the code. :run will run the code immediately without waiting.
source
JolinPluto.@repeat_run — Macro
@repeat_run(expr_used_for_init_and_repeated_execution)
@repeat_run(expr_for_init, expr_for_repetition)

Repeat some long expression. It will run offline in a separate Task so that interactivity is preserved.

Optionally, specify another expression for initialization. Initialization will also be triggered if the cell is re-evaluated because some dependent cell or bond changed.

source
JolinPluto.@repeat_take! — Macro
nextvalue = @repeat_take! channel

This will repeatedly fetch for the next element from the given channel, re-evaluating the cell each time a new value arrives.

source