Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit f941b1310b50292749bc030b1bf5e1ef57cdf0f5
parent 491b04cf5abed3d23bb9cefa7d94a4777cd90288
Author: Sergio Benitez <sb@sergio.bz>
Date:   Fri, 10 Aug 2018 23:03:13 -0700

Improve template engine customization docs.

Diffstat:
Mcontrib/lib/src/templates/mod.rs | 2+-
Msite/guide/responses.md | 9+++++----
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/contrib/lib/src/templates/mod.rs b/contrib/lib/src/templates/mod.rs @@ -125,7 +125,7 @@ const DEFAULT_TEMPLATE_DIR: &'static str = "templates"; /// } /// ``` /// -/// # Customizing +/// # Helpers, Filters, and Customization /// /// You can use the [`Template::custom()`] method to construct a fairing with /// customized templating engines. Among other things, this method allows you to diff --git a/site/guide/responses.md b/site/guide/responses.md @@ -257,7 +257,7 @@ a template and a context to render the template with. The context can be any type that implements `Serialize` and serializes into an `Object` value, such as structs, `HashMaps`, and others. -Rocket searches for a template with the given name in the configurable +Rocket searches for a template with the given name in the [configurable] `template_dir` directory. Templating support in Rocket is engine agnostic. The engine used to render a template depends on the template file's extension. For example, if a file ends with `.hbs`, Handlebars is used, while if a file ends @@ -281,10 +281,11 @@ fn main() { } ``` -The [`Template`] API -documentation contains more information about templates, while the [Handlebars -Templates example on +The [`Template`] API documentation contains more information about templates, +including how to customize a template engine to add custom helpers and filters. +The [Handlebars Templates example on GitHub](https://github.com/SergioBenitez/Rocket/tree/v0.4.0-dev/examples/handlebars_templates) is a fully composed application that makes use of Handlebars templates. [`Template`]: https://api.rocket.rs/rocket_contrib/struct.Template.html +[configurable]: /guide/configuration/#extras