Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed broken foreach in 0.5 #117

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions assets/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
all:
vulcanize --inline basics.html -o build/basics.html
vulcanize --config exclude-basics.json codemirror.html -o build/codemirror.html
vulcanize --config exclude-basics.json jsonmirror.html -o build/jsonmirror.html
vulcanize --config exclude-basics.json layout2.html -o build/layout2.html
vulcanize --config exclude-basics.json icons.html -o build/icons.html
vulcanize --config exclude-basics.json widgets.html -o build/widgets.html
Expand Down
3 changes: 2 additions & 1 deletion assets/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.0.0",
"neon-animation": "PolymerElements/neon-animation#^1.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
"code-mirror": "shashi/code-mirror#master"
"code-mirror": "shashi/code-mirror#master",
"json-mirror": "dioptre/json-mirror#master"
}
}
3 changes: 3 additions & 0 deletions assets/jsonmirror.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

<link rel="import" href="bower_components/json-mirror/json-mirror.html">
<link rel="import" href="bower_components/iron-flex-layout/classes/iron-flex-layout.html">
7 changes: 7 additions & 0 deletions examples/json.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function main(window)
push!(window.assets, "jsonmirror")
slideshow([
plaintext("Look at the souce code to see js/console help"),
jsonmirror("{metadata:{ a: 'meta1'}}, data:[1,2,3,4,5]}", name="asdd", id="idx-333")
])
end
68 changes: 68 additions & 0 deletions examples/repl.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using Markdown

# Function that executes code and
# returns the result
execute_code(code) = begin
try
parse("begin\n" * code * "\nend") |> eval
catch ex
sprint() do io
showerror(io, ex)
println(io)
Base.show_backtrace(io, catch_backtrace())
end
end
end

## View

# Code mirror to input some code
showinput(code;kwargs...) = begin
s = sampler()

@show kwargs
codemirror(code; kwargs...) |>
#watch!(s, :name) |>
keypress("ctrl+enter") #|>
#trigger!(s) |>
#plugsampler(s)
end

getcode(x) = x[:code]
code_io(code, code_input; kwargs...) = begin
addinterpreter(getcode, showinput(code; name=:code, kwargs...)) >>> code_input
end

# Output area
showoutput(code) = begin
obj = try
execute_code(code)
catch ex
sprint() do io
showerror(io, ex)
println(io)
Base.show_backtrace(io, catch_backtrace())
end
end
try
convert(Tile, obj)
catch codemirror(string(obj), readonly=true, linenumbers=false)
end
end

# REPL
newrepl() = vbox(empty)
function append_execution(repl, code)
cell_sig = Input(code)
println(cell_sig)
vbox(
vcat(
repl.tiles.tiles,
vbox(
code_io(code, cell_sig, linenumbers=false, name=:code),
lift(showoutput, cell_sig)
)
)
)
end

Loading