diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2019-03-18 10:24:26 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2019-03-18 10:24:26 +0100 |
commit | 37fb230e2e9aa4d9993a7c5774e48a8f6d87a294 (patch) | |
tree | 27126de64864e0ee04fc0198f80d35776430c809 | |
parent | 703ab6e3c7b3a885a5745949750ca54b68dd4569 (diff) | |
download | askama-37fb230e2e9aa4d9993a7c5774e48a8f6d87a294.tar.gz askama-37fb230e2e9aa4d9993a7c5774e48a8f6d87a294.tar.bz2 askama-37fb230e2e9aa4d9993a7c5774e48a8f6d87a294.zip |
Tweak documentation a little bit
Diffstat (limited to '')
-rw-r--r-- | askama/src/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/askama/src/lib.rs b/askama/src/lib.rs index bd5078f..d48a546 100644 --- a/askama/src/lib.rs +++ b/askama/src/lib.rs @@ -371,11 +371,11 @@ //! recursion. This is because the `Display` implementation for that expression //! will in turn evaluate the expression and yield `self` again. //! -//! ## Template in template +//! ## Templates in templates //! -//! Using expressions, it is possible to render a template inside another one. This functionality -//! allows modularize template sections and inject them in another template. This -//! facilitates testing, and reusing part of templates. +//! Using expressions, it is possible to delegate rendering part of a template to another template. +//! This makes it possible to inject modular template sections into other templates and facilitates +//! testing and reuse. //! //! ```rust //! use askama::Template; @@ -384,13 +384,14 @@ //! struct RenderInPlace<'a> { //! s1: SectionOne<'a> //! } +//! //! #[derive(Template)] //! #[template(source = "A={{ a }}\nB={{ b }}", ext = "txt")] //! struct SectionOne<'a> { //! a: &'a str, //! b: &'a str, //! } -//! let t = RenderInPlace{s1: SectionOne{a: "a", b: "b"}}; +//! let t = RenderInPlace { s1: SectionOne { a: "a", b: "b" } }; //! assert_eq!(t.render().unwrap(), "Section 1: A=a\nB=b") //! ``` //! |