Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

extras/web_winston: inline plots in the web repl

  • Loading branch information...
commit a38893b5beb8addba14234649ebaf2f9ca49941a 1 parent 41288d8
@nolta nolta authored
Showing with 13 additions and 1 deletion.
  1. +4 −1 extras/julia_web_base.jl
  2. +9 −0 extras/web_winston.jl
View
5 extras/julia_web_base.jl
@@ -173,6 +173,9 @@ end
# event handler for socket input
add_fd_handler(__connectfd, __socket_callback)
+web_show(user_id, ans) =
+ __Message(__MSG_OUTPUT_EVAL_RESULT, {user_id, sprint(repl_show, ans)})
+
function __eval_exprs(__parsed_exprs)
global ans
user_id = ""
@@ -192,7 +195,7 @@ function __eval_exprs(__parsed_exprs)
if isa(ans,Nothing)
return __write_message(__Message(__MSG_OUTPUT_EVAL_RESULT, {user_id, ""}))
else
- return __write_message(__Message(__MSG_OUTPUT_EVAL_RESULT, {user_id, sprint(repl_show, ans)}))
+ return __write_message(web_show(user_id, ans))
end
end
View
9 extras/web_winston.jl
@@ -0,0 +1,9 @@
+#
+# Load this file in the web repl to display winston plots inline.
+#
+
+load("winston.jl")
+import Winston.*
+
+web_show(user_id, p::PlotContainer) = __Message(__MSG_OUTPUT_HTML, {user_id,svg(p)})
+
Please sign in to comment.
Something went wrong with that request. Please try again.