Skip to content

Commit

Permalink
v0.31.4
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Jul 1, 2020
1 parent fcf5d4a commit 9d835e0
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/tests_markdown_rendering.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@safetestset "Markdown rendering" begin

@safetestset "String markdown rendering" begin
using Genie
using Genie.Renderer.Html
using Markdown

view = raw"""
# Hello
## Welcome to Genie""" |> Markdown.parse

@test (Html.html(view, forceparse = true).body |> String) == "<html><head></head><body><h1>Hello</h1><h2>Welcome to Genie</h2></body></html>"

view = raw"""
# Hello
## Welcome to Genie, $name""" |> Markdown.parse

@test (Html.html(view, name = "John").body |> String) == "<html><head></head><body><h1>Hello</h1><h2>Welcome to Genie, John</h2></body></html>"

layout = raw"""
<div>
<h1>Layout header</h1>
<section>
<% @yield %>
</section>
<footer>
<h4>Layout footer</h4>
</footer>
</div>"""

@test (Html.html(view, layout = layout, name = "John").body |> String) == "<html><head></head><body><div><h1>Layout header</h1><section><h1>Hello</h1><h2>Welcome to Genie, John</h2></section><footer><h4>Layout footer</h4></footer></div></body></html>"
end;

@safetestset "Template markdown rendering" begin
using Genie, Genie.Renderer
using Genie.Renderer.Html

@test Html.html(filepath("views/view.jl.md"), numbers = [1, 1, 2, 3, 5, 8, 13]).body |> String == "<html><head></head><body><h1>There are 7</h1><p>-> 1 -> 1 -> 2 -> 3 -> 5 -> 8 -> 13</p></body></html>"
@test Html.html(filepath("views/view.jl.md"), layout = filepath("views/layout.jl.html"), numbers = [1, 1, 2, 3, 5, 8, 13]).body |> String ==
"<html><head></head><body><div><h1>Layout header</h1><section><h1>There are 7</h1><p>-> 1 -> 1 -> 2 -> 3 -> 5 -> 8 -> 13</p></section><footer><h4>Layout footer</h4></footer></div></body></html>"
end

end;
9 changes: 9 additions & 0 deletions test/views/layout.jl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div>
<h1>Layout header</h1>
<section>
<% @yield %>
</section>
<footer>
<h4>Layout footer</h4>
</footer>
</div>
8 changes: 8 additions & 0 deletions test/views/view.jl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# There are $(length(numbers))

$(
@foreach(numbers) do number
" -> $number
"
end
)

2 comments on commit 9d835e0

@essenciary
Copy link
Member Author

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/17286

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 the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.31.4 -m "<description of version>" 9d835e0683eb2f5d7bdb121958aac2beb7fd9b5f
git push origin v0.31.4

Please sign in to comment.