-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcf5d4a
commit 9d835e0
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# There are $(length(numbers)) | ||
|
||
$( | ||
@foreach(numbers) do number | ||
" -> $number | ||
" | ||
end | ||
) |
9d835e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
9d835e0
There was a problem hiding this comment.
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: