From d843e8354cab83db5fce47c395fada06bd38eeb5 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Fri, 4 Nov 2016 15:33:58 +0100 Subject: [PATCH] Use handlebars so that message is escaped in cookies example. --- examples/cookies/Cargo.toml | 2 +- examples/cookies/src/main.rs | 3 +-- .../cookies/templates/{index.html.tera => index.html.hbs} | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) rename examples/cookies/templates/{index.html.tera => index.html.hbs} (84%) diff --git a/examples/cookies/Cargo.toml b/examples/cookies/Cargo.toml index 8ff982a0..ecfac4b4 100644 --- a/examples/cookies/Cargo.toml +++ b/examples/cookies/Cargo.toml @@ -12,4 +12,4 @@ lazy_static = "*" [dependencies.rocket_contrib] path = "../../contrib" default-features = false -features = ["tera_templates"] +features = ["handlebars_templates"] diff --git a/examples/cookies/src/main.rs b/examples/cookies/src/main.rs index 924e1b73..7a10613c 100644 --- a/examples/cookies/src/main.rs +++ b/examples/cookies/src/main.rs @@ -1,8 +1,7 @@ #![feature(plugin, custom_derive, custom_attribute)] #![plugin(rocket_codegen)] -#[macro_use] -extern crate lazy_static; +#[macro_use] extern crate lazy_static; extern crate rocket_contrib; extern crate rocket; diff --git a/examples/cookies/templates/index.html.tera b/examples/cookies/templates/index.html.hbs similarity index 84% rename from examples/cookies/templates/index.html.tera rename to examples/cookies/templates/index.html.hbs index 1ec908d4..de4be354 100644 --- a/examples/cookies/templates/index.html.tera +++ b/examples/cookies/templates/index.html.hbs @@ -7,11 +7,11 @@

Rocket Cookie Examples

- {% if message is defined %} -

{{ message }}

- {% else %} + {{#if message }} +

{{message}}

+ {{else}}

No message yet.

- {% endif %} + {{/if}}