From 37fb230e2e9aa4d9993a7c5774e48a8f6d87a294 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 18 Mar 2019 10:24:26 +0100 Subject: Tweak documentation a little bit --- askama/src/lib.rs | 11 ++++++----- 1 file 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") //! ``` //! -- cgit