diff --git a/template_yarte/Cargo.toml b/template_yarte/Cargo.toml index 0069a0df..90272f29 100644 --- a/template_yarte/Cargo.toml +++ b/template_yarte/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "template_yarte" version = "0.0.1" -authors = ["Rust-iendo "] +authors = ["Juan Aguilar Santillana "] publish = false edition = "2018" workspace = ".." [dependencies] -env_logger = "0.6" +env_logger = "0.7" yarte = { version = "0.3", features=["with-actix-web"] } diff --git a/template_yarte/README.md b/template_yarte/README.md index 21de4169..4a1fa5f6 100644 --- a/template_yarte/README.md +++ b/template_yarte/README.md @@ -1,8 +1,8 @@ # yarte -Minimal example of using template [yarte](https://gitlab.com/r-iendo/yarte) that displays a form. +Minimal example of using template [yarte](https://github.com/botika/yarte) that displays a form. -[Template benchmarks in stable](https://gitlab.com/botika/template-benchmarks-rs) +[Template benchmarks in stable](https://github.com/botika/template-bench-rs) ```bash cargo test diff --git a/template_yarte/build.rs b/template_yarte/build.rs index da256d18..2074d9f3 100644 --- a/template_yarte/build.rs +++ b/template_yarte/build.rs @@ -1,5 +1,3 @@ -use yarte::recompile; - fn main() { - recompile::when_changed(); + yarte::recompile::when_changed(); } diff --git a/template_yarte/templates/body.hbs b/template_yarte/templates/body.hbs new file mode 100644 index 00000000..c521f566 --- /dev/null +++ b/template_yarte/templates/body.hbs @@ -0,0 +1,10 @@ + + +{{~#if let Some(name) = query.get("name") }} + {{ let lastname = query.get("lastname").ok_or(yarte::Error)? }} + {{> card/hi ~}} +{{ else ~}} + {{> card/form ~}} +{{/if ~}} + + diff --git a/template_yarte/templates/index.hbs b/template_yarte/templates/index.hbs index b3afdf48..9e15f7a5 100644 --- a/template_yarte/templates/index.hbs +++ b/template_yarte/templates/index.hbs @@ -1,12 +1,8 @@ {{! Simple example !}} {{> doc/t ~}} -{{~> doc/head title = "Actix web" ~}} - - {{~#if let Some(name) = query.get("name") }} - {{ let lastname = query.get("lastname").ok_or(yarte::Error)? }} - {{> card/hi ~}} - {{ else ~}} - {{> card/form ~}} - {{/if ~}} - + +{{~> doc/head title = "Actix web" }} +{{~> body ~}} + +