mirror of
https://github.com/rwf2/Rocket.git
synced 2025-02-16 13:42:05 +00:00
Improve template engine customization docs.
This commit is contained in:
parent
491b04cf5a
commit
f941b1310b
@ -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
|
/// You can use the [`Template::custom()`] method to construct a fairing with
|
||||||
/// customized templating engines. Among other things, this method allows you to
|
/// customized templating engines. Among other things, this method allows you to
|
||||||
|
@ -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
|
type that implements `Serialize` and serializes into an `Object` value, such as
|
||||||
structs, `HashMaps`, and others.
|
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
|
`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
|
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
|
example, if a file ends with `.hbs`, Handlebars is used, while if a file ends
|
||||||
@ -281,10 +281,11 @@ fn main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The [`Template`] API
|
The [`Template`] API documentation contains more information about templates,
|
||||||
documentation contains more information about templates, while the [Handlebars
|
including how to customize a template engine to add custom helpers and filters.
|
||||||
Templates example on
|
The [Handlebars Templates example on
|
||||||
GitHub](https://github.com/SergioBenitez/Rocket/tree/v0.4.0-dev/examples/handlebars_templates)
|
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.
|
is a fully composed application that makes use of Handlebars templates.
|
||||||
|
|
||||||
[`Template`]: https://api.rocket.rs/rocket_contrib/struct.Template.html
|
[`Template`]: https://api.rocket.rs/rocket_contrib/struct.Template.html
|
||||||
|
[configurable]: /guide/configuration/#extras
|
||||||
|
Loading…
Reference in New Issue
Block a user