aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askama/src/lib.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index a7de51a..cf6bf30 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -402,6 +402,29 @@
//!
//! Askama supports block comments delimited by `{#` and `#}`.
//!
+//!
+//! ## Recursive Structures
+//!
+//! Recursive implementations should preferably use a custom iterator and
+//! use a plain loop. If that is not doable, call `.render()`
+//! directly by using an expression as shown below.
+//! Including self does not work, see #105 and #220 .
+//!
+//! ```rust
+//! use askama::Template;
+//!
+//! #[derive(Template)]
+//! #[template(source = r#"
+//! //! {% for item in children %}
+//! {{ item.render().unwrap() }}
+//! {% endfor %}
+//! "#, ext = "html", escape = "none")]
+//! struct Item<'a> {
+//! name: &'a str,
+//! children: &'a [Item<'a>],
+//! }
+//! ```
+//!
//! # Optional functionality
//!
//! ## Rocket integration