From 47f433790f2d35f440d05bb4dcd995df4798b10c Mon Sep 17 00:00:00 2001 From: Rasmus Kaj Date: Sun, 30 Jun 2024 17:07:12 +0200 Subject: [PATCH] Workaround for #134. Gave up on finding a real fix for #134, so documenting a workaround instead. --- .../warp03/templates/intermediate.rs.html | 2 +- src/Template_syntax.rs | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/examples/warp03/templates/intermediate.rs.html b/examples/warp03/templates/intermediate.rs.html index 653f79e..be3fa56 100644 --- a/examples/warp03/templates/intermediate.rs.html +++ b/examples/warp03/templates/intermediate.rs.html @@ -1,7 +1,7 @@ @use super::base_html; @(title: &str, htmlargs: Content, content: Content) -@:base_html(title, htmlargs, { +@:base_html(title, {@:htmlargs()}, { @:content()

This whole site is an example.

}) diff --git a/src/Template_syntax.rs b/src/Template_syntax.rs index 90fdf70..7fe77ef 100644 --- a/src/Template_syntax.rs +++ b/src/Template_syntax.rs @@ -301,4 +301,26 @@ pub mod d_Calling_other_templates { //!

page content ...

//! }) //! ``` + //! + //! ## 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()}) + //! }} + //! ``` }