Skip to content

Commit

Permalink
v0.22.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian committed Dec 5, 2019
1 parent e604d3e commit 4fa0288
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 10 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Changelog

## v0.22.5 - 2019-12-04
## v0.22.8 - 2019-12-05

* more tests
* support for `if` blocks
* internal API refactoring

## v0.22.7 - 2019-12-04

* added support for `if` blocks
* performance optimisations

## v0.22.5 - 2019-12-03
## v0.22.6 - 2019-12-03

* bug fixes
* deps update
Expand Down
4 changes: 2 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ version = "0.21.0"

[[JuliaInterpreter]]
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
git-tree-sha1 = "5bb6a8b09d881c1cbe39bd8135667ed5978168e9"
git-tree-sha1 = "0bf5e88aa07b9ffe36dca3215642d5d1ea2901cc"
uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
version = "0.7.4"
version = "0.7.5"

[[LibGit2]]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Genie"
uuid = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
authors = ["Adrian Salceanu <[email protected]>"]
version = "0.22.7"
version = "0.22.8"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Core genie configuration / settings functionality.
"""
module Configuration

const GENIE_VERSION = v"0.22.7"
const GENIE_VERSION = v"0.22.8"

import Logging
import Genie
Expand Down
17 changes: 13 additions & 4 deletions src/Flax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const Path = FilePaths.Path
const FilePath = Union{FilePaths.PosixPath,FilePaths.WindowsPath}
const filepath = FilePaths.Path

include("HTMLRenderer.jl")
include("renderers/HTMLRenderer.jl")
using .HTMLRenderer

include("JSONRenderer.jl")
include("renderers/JSONRenderer.jl")
using .JSONRenderer

include("JSRenderer.jl")
include("renderers/JSRenderer.jl")
using .JSRenderer


Expand Down Expand Up @@ -248,9 +248,13 @@ Parses special Flax tags.
function parsetags(line::Tuple{Int,String}) :: String
parsetags(line[2])
end


function parsetags(code::String) :: String
code = replace(code, "<%"=>"""<script type="julia/eval">""")

occursin(" if ", code) && (code = replace(code, " if "=>" Flax.@condblock if "))

replace(code, "%>"=>"""</script>""")
end

Expand Down Expand Up @@ -337,7 +341,12 @@ end


macro condblock(expr)
expr.args[2] = esc(:([$([arg for arg in expr.args[2].args if !isa(arg, LineNumberNode)]...),]))
# dump(expr)

expr.args[2] = quote
join([$([arg for arg in expr.args[2].args if !isa(arg, LineNumberNode)]...),])
end

expr
end

Expand Down
1 change: 1 addition & 0 deletions src/Genie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Logging, LoggingExtras

push!(LOAD_PATH, joinpath(@__DIR__, "cache_adapters"),
joinpath(@__DIR__, "session_adapters"),
joinpath(@__DIR__, "renderers"),
config.path_resources, config.path_helpers)

include(joinpath(@__DIR__, "genie_types.jl"))
Expand Down
2 changes: 2 additions & 0 deletions src/Renderer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,10 @@ function hasrequested(content_type::Symbol) :: Bool
task_local_storage(:__params)[:response_type] == content_type
end


### RESPONSES ###


"""
Constructs a `Response` corresponding to the content-type sof the request.
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions test/tests_flax_control_flow_rendering.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@safetestset "Control flow rendering" begin
@safetestset "IF conditional rendering" begin
@safetestset "IF true" begin
using Genie
using Genie.Renderer

view = raw"""
<section class='block'>
<% if true %>
<h1>Hello</h1>
<p>Welcome</p>
<% end %>
</section>"""

@test String(html(view).body) == raw"<html><head></head><body><section class=\"block\"><h1>Hello</h1><p>Welcome</p></section></body></html>"
end;

@safetestset "IF false" begin
using Genie
using Genie.Renderer

view = raw"""
<section class='block'>
<% if false %>
<h1>Hello</h1>
<p>Welcome</p>
<% end %>
</section>"""

@test String(html(view).body) == raw"""<html><head></head><body><section class="block"></section></body></html>"""
end;
end;
end;

2 comments on commit 4fa0288

@essenciary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/6300

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.22.8 -m "<description of version>" 4fa02880d245bc042ca64c672367c9230b82ecf9
git push origin v0.22.8

Please sign in to comment.