Skip to content

Commit

Permalink
Workaround for #134.
Browse files Browse the repository at this point in the history
Gave up on finding a real fix for #134, so documenting a workaround
instead.
  • Loading branch information
kaj committed Jun 30, 2024
1 parent 7829618 commit 47f4337
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/warp03/templates/intermediate.rs.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use super::base_html;

@(title: &str, htmlargs: Content, content: Content)
@:base_html(title, htmlargs, {
@:base_html(title, {@:htmlargs()}, {
@:content()
<p>This whole site is an example.</p>
})
22 changes: 22 additions & 0 deletions src/Template_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,26 @@ pub mod d_Calling_other_templates {
//! <p>page content ...</p>
//! })
//! ```
//!
//! ## Intermediate templates with block parameters
//!
//! Due to a limitation in Ructe, it is currently not possible to
//! take a block parameter and send directly along to further
//! templates.
//! The following will not work:
//!
//! ```compile_fail
//! @(title: &str, body: Content) {{
//! @:base_page_html(title, body)
//! }}
//! ```
//!
//! Instead, the parameter needs to be a block, even if only to
//! call the existing one:
//!
//! ```text
//! @(title: &str, body: Content) {{
//! @:base_page_html(title, {@:body()})
//! }}
//! ```
}

0 comments on commit 47f4337

Please sign in to comment.