Skip to content

Commit

Permalink
Add failing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaj committed Jun 25, 2024
1 parent defcf7c commit c984820
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
15 changes: 8 additions & 7 deletions examples/simple/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,17 @@ fn test_page_with_base() {
r2s(|o| page::page_html(o, "World")),
"<!doctype html>\
\n<html>\
\n <head><title>Hello World!</title>\
\n <meta property=\"og:description\" content=\"A simple example\"/>\
\n <head><title>Hello World!</title>\n\
\n <meta property=\"og:description\" content=\"A simple example\"/>\n\
\n</head>\
\n <body>\
\n <h1>Hello World!</h1>\
\n \
\n <p>This is page content for World</p>\
\n\
\n </body>\
\n</html>\n\n"
\n \n<div>\
\n \
\n <p>This is page content for World</p>\n\
\n</div>\n<footer>A footer common to some pages.</footer>\
\n\n </body>\
\n</html>\n\n\n"
);
}

Expand Down
12 changes: 12 additions & 0 deletions examples/simple/templates/page/intermediate.rs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use super::base_html;

@(title: &str, content: Content, meta: Content)

@:base_html(title, {
<div>
@:content()
</div>
<footer>A footer common to some pages.</footer>
}, {
@:meta()
})
4 changes: 2 additions & 2 deletions examples/simple/templates/page/page.rs.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@use super::base_html;
@use super::intermediate_html;

@(who: &str)

@:base_html(&format!("Hello {who}!"), {
@:intermediate_html(&format!("Hello {who}!"), {
<p>This is page content for @who</p>
}, {
<meta property="og:description" content="A simple example"/>
Expand Down

0 comments on commit c984820

Please sign in to comment.