Commit Graph

31 Commits

Author SHA1 Message Date
Roman Frołow 8555a0fad5 Fix typo in Template documentation: words -> works. 2017-04-18 19:52:18 -07:00
Sergio Benitez 605e8fdc0e Update Tera to 0.8. 2017-03-23 15:28:49 -07:00
Sergio Benitez 46403b8d0a Iterate through Tera error chain for better errors. 2017-02-17 00:23:41 -08:00
Sergio Benitez 84abac7f2b Unignore template test. Upstream fix landed. 2017-02-02 18:48:34 -08:00
Sergio Benitez 2b65be32e0 Ignore render example due to broken upstream crate. 2017-02-02 15:39:30 -08:00
Sergio Benitez 5fabb43a1b Update to serde 0.9, handlebars 0.25. Move from `map!` to `json!` macro.
Resolves #154.
2017-01-31 17:15:42 -08:00
Sergio Benitez 8fd19cce4f Use upstream Tera. Emit warning on conflicting templates. 2017-01-26 12:47:20 -08:00
Sergio Benitez 3c07cf96df Overhaul templating contrib library: use `register` callback.
This commit improves and changes the templating library in the following ways:

  * Templates are now registered/loaded at initialization.
  * No synchronization is required to read templates.
  * All templates are properly loaded (fixes #122).
  * Tera templates are given the proper name: `index`, not `index.html.tera`.
  * Rendering tests added for both templating engines.

There is one breaking change:

  * Tera templates are given the proper name: `index`, not `index.html.tera`.
2017-01-12 02:52:23 -08:00
Sergio Benitez f43f77dbfc Improve Template docs and implement Display. 2016-12-29 13:20:30 -06:00
Marcus Ball a33e225e71 Properly resolve nested template names on Windows. 2016-12-28 23:04:18 -06:00
Joel Roller 8deac6dba9 Add '.tera' extension to default Tera escapes. 2016-12-28 21:11:56 -06:00
Eric D. Reichert 13cac7db45 Fix URL to config guide in templates/mod.rs. 2016-12-26 19:05:06 -06:00
Sergio Benitez 89f42a614d Properly resolve nested template names in contrib.
Fixes #42.
2016-12-24 14:03:56 -08:00
Sergio Benitez e76ba7d219 Document the JSON responder, default template dir. 2016-12-23 02:38:30 -08:00
Sergio Benitez 5540201236 Fix fallout from Tera dependency update. 2016-12-19 21:04:40 -08:00
Sergio Benitez 44f5f1998d New HTTP types: ContentType, Status. Responder/Handler/ErrorHandler changed.
This is a complete rework of `Responder`s and of the http backend in
general. This gets Rocket one step closer to HTTP library independence,
enabling many future features such as transparent async I/O, automatic
HEAD request parsing, pre/post hooks, and more.

Summary of changes:

  * `Responder::response` no longer takes in `FreshHyperResponse`.
    Instead, it returns a new `Response` type.
  * The new `Response` type now encapsulates a full HTTP response. As a
    result, `Responder`s now return it.
  * The `Handler` type now returns an `Outcome` directly.
  * The `ErrorHandler` returns a `Result`. It can no longer forward,
    which made no sense previously.
  * `Stream` accepts a chunked size parameter.
  * `StatusCode` removed in favor of new `Status` type.
  * `ContentType` significantly modified.
  * New, lightweight `Header` type that plays nicely with `Response`.
2016-12-15 00:47:31 -08:00
Sergio Benitez f5a5ea3a22 Rename `data` to `content` in `response`. Remove `DataOutcome`. 2016-10-25 13:03:50 +02:00
Sergio Benitez 5447f81f77 Remove RequestOutcome, ResponseOutcome in favor of Outcome. Remove Failure response type. 2016-10-25 11:17:49 +02:00
Sergio Benitez 2a0535e1f7 Document the config module. 2016-10-18 12:04:56 -07:00
Sergio Benitez 1323e7a420 Add `config::get()`, for global config access. Use it for `Template`. 2016-10-14 18:57:36 -07:00
Sergio Benitez 722f613686 Use Outcome as the result of all fallible conversions. 2016-10-13 18:39:23 -07:00
Sergio Benitez d8db812856 Implement streaming requests. 2016-10-09 04:29:02 -07:00
Sergio Benitez 8c0d11feab Completely new raw API.
Summary of changes:

  * Request no longer has a lifetime parameter.
  * Handler type now includes a `Data` parameter.
  * Response is now an enum that is either `Complete` or `Forward`.
  * Outcome enum is now one of: Success, Failure, Forward.
  * Outcome::Foward for Responses must include StatusCode.
  * Responders are now final: they cannot forward to requests. (!!)
  * Responsers may only forward to catchers. (!!)
  * Response no longer provides wrapping methods.
  * Route is now cloneable.

This change is fundamental to enabling streaming requests.
2016-10-07 23:20:49 -07:00
Sergio Benitez 916bf7310a Add details about Template usage in contrib. 2016-10-07 19:12:58 -07:00
Sergio Benitez be3530bb44 Make Outcome generic on its encapsulated type. 2016-10-07 19:09:05 -07:00
Sergio Benitez 74ec26db95 Namespace HTTP-related type under `http`. 2016-10-03 17:09:13 -07:00
Sergio Benitez 804154e537 Improve documentation for contrib library. 2016-09-29 21:26:06 -07:00
Sergio Benitez 5b5cb7e087 Send the correct content type in Template contrib. 2016-09-25 03:06:02 -07:00
Sergio Benitez f088459621 Require commas in template macros. 2016-09-22 21:29:03 -07:00
Sergio Benitez d9e8a79ff6 Add template features to contrib doc. 2016-09-22 04:24:04 -07:00
Sergio Benitez f74e286e31 Add templating support in contrib crate.
The contrib crate now contains support for both Handlebars and Tera. No
documentation yet.

resolves #5
2016-09-22 04:12:07 -07:00