diff --git a/src/block.jl b/src/block.jl index f4c4272..1c6bc00 100644 --- a/src/block.jl +++ b/src/block.jl @@ -29,6 +29,9 @@ function (TB::TmpBlock)(filters::Dict{String, Symbol}, autoescape::Bool) t = typeof(content) if isa(content, TmpStatement) code *= "$(content.st);" + elseif isa(content, JLCodeBlock) + jl_code = replace(content.code, "\n"=>";") + code *= "txt *= begin;$jl_code;end;" elseif isa(content, VariableBlock) if occursin("|>", content.exp) exp = map(strip, split(content.exp, "|>")) diff --git a/test/runtests.jl b/test/runtests.jl index 6bd3090..a222a8e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -54,7 +54,7 @@ using Test # check Julia block inside inherited block tmp = Template("super4.html", config=Dict("lstrip_blocks"=>true, "trim_blocks"=>true)) - @test occursin("Hello from Julia", tmp()) broken = true + @test occursin("Hello from Julia", tmp()) # check TmpBlock tmp = Template("block1.html", config=Dict("lstrip_blocks"=>true, "trim_blocks"=>true)) diff --git a/test/super4.html b/test/super4.html index c85fe1a..581c1d7 100644 --- a/test/super4.html +++ b/test/super4.html @@ -1,5 +1,5 @@ {% extends "super2.html" %} {% block inherite %} - {< "Hello from Julia" >} + {< "Hello from Julia" >} {% endblock %}