"""
end
# The whole page has to load and then hooks are mounded.
# There may be a tiny delay before the markdown is rendered
# or and editors are mounted, so show neat placeholders immediately.
defp render_markdown_content_placeholder(empty: true) do
assigns = %{}
~L"""
"""
end
defp render_markdown_content_placeholder(empty: false) do
assigns = %{}
~L"""
"""
end
defp render_editor_content_placeholder(empty: true) do
assigns = %{}
~L"""
"""
end
defp render_editor_content_placeholder(empty: false) do
assigns = %{}
~L"""
"""
end
defp render_outputs(assigns) do
~L"""
<%= for {output, index} <- @cell_view.outputs |> Enum.reverse() |> Enum.with_index(), output != :ignored do %>
"""
end
defp render_output(output, id) when is_binary(output) do
# Captured output usually has a trailing newline that we can ignore,
# because each line is itself a block anyway.
output = String.replace_suffix(output, "\n", "")
lines = ansi_to_html_lines(output)
assigns = %{lines: lines, id: id}
~L"""
<%= for line <- @lines do %>
<%= line %>
<% end %>
"""
end
defp render_output({:inspect, inspected}, id) do
lines = ansi_to_html_lines(inspected)
assigns = %{lines: lines, id: id}
~L"""
<%= for line <- @lines do %>
<%= line %>
<% end %>
"""
end
defp render_output({:error, formatted}, _id) do
assigns = %{formatted: formatted}
~L"""
<%= @formatted %>
"""
end
defp render_cell_status(validity_status, evaluation_status, changed)
defp render_cell_status(_, :evaluating, changed) do
render_status_indicator("Evaluating", "bg-blue-500", "bg-blue-400", changed)
end
defp render_cell_status(_, :queued, _) do
render_status_indicator("Queued", "bg-gray-500", "bg-gray-400", false)
end
defp render_cell_status(:evaluated, _, changed) do
render_status_indicator("Evaluated", "bg-green-400", nil, changed)
end
defp render_cell_status(:stale, _, changed) do
render_status_indicator("Stale", "bg-yellow-200", nil, changed)
end
defp render_cell_status(:aborted, _, _) do
render_status_indicator("Aborted", "bg-red-400", nil, false)
end
defp render_cell_status(_, _, _), do: nil
defp render_status_indicator(text, circle_class, animated_circle_class, show_changed) do
assigns = %{
text: text,
circle_class: circle_class,
animated_circle_class: animated_circle_class,
show_changed: show_changed
}
~L"""