From 916bf7310a0c75f477bd4a6c14bbee1176ac46ae Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Fri, 7 Oct 2016 19:12:58 -0700 Subject: [PATCH] Add details about Template usage in contrib. --- contrib/src/lib.rs | 2 +- contrib/src/templates/mod.rs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/contrib/src/lib.rs b/contrib/src/lib.rs index a7c66d89..ef59c9ff 100644 --- a/contrib/src/lib.rs +++ b/contrib/src/lib.rs @@ -21,7 +21,7 @@ //! `Cargo.toml` file, setting `default-features` to false, and specifying //! features manually. For example, to use the JSON module, you would add: //! -//! ```rust,ignore +//! ```toml,ignore //! [dependencies.rocket_contrib] //! version = "*" //! default-features = false diff --git a/contrib/src/templates/mod.rs b/contrib/src/templates/mod.rs index 73625ff4..cc1d72dc 100644 --- a/contrib/src/templates/mod.rs +++ b/contrib/src/templates/mod.rs @@ -44,9 +44,10 @@ use rocket::http::ContentType; /// right) given that the template is at the path on the left. /// /// * `{template_dir}/index.html.hbs` => index +/// * `{template_dir}/index.tera` => index /// * `{template_dir}/index.hbs` => index /// * `{template_dir}/dir/index.hbs` => dir/index -/// * `{template_dir}/dir/index.html.hbs` => dir/index +/// * `{template_dir}/dir/index.html.tera` => dir/index /// * `{template_dir}/index.template.html.hbs` => index.template /// * `{template_dir}/subdir/index.template.html.hbs` => subdir/index.template /// @@ -60,6 +61,19 @@ use rocket::http::ContentType; /// [Serde](https://github.com/serde-rs/json) and would serialize to an `Object` /// value. /// +/// # Usage +/// +/// To use, add the `handlebars_templates` feature, the `tera_templates` +/// feature, or both, to the `rocket_contrib` dependencies section of your +/// `Cargo.toml`: +/// +/// ```toml,ignore +/// [dependencies.rocket_contrib] +/// version = "*" +/// default-features = false +/// features = ["handlebars_templates", "tera_templates"] +/// ``` +/// /// # Examples /// /// To render a template named "index" with a `HashMap` as the context: