@@ -5,7 +5,7 @@ use std::io::{Read};
55use util:: { CargoResult , human, ChainError } ;
66use url:: Url ;
77
8- use handlebars:: { Context , Helper , Handlebars , RenderContext , RenderError , html_escape} ;
8+ use handlebars:: { Helper , Handlebars , RenderContext , RenderError , html_escape} ;
99use tempdir:: TempDir ;
1010use toml;
1111
@@ -14,8 +14,7 @@ use toml;
1414/// So if 'name' is "foo \"bar\"" then:
1515/// {{name}} renders as 'foo "bar"'
1616/// {{#toml-escape name}} renders as '"foo \"bar\""'
17- pub fn toml_escape_helper ( _: & Context ,
18- h : & Helper ,
17+ pub fn toml_escape_helper ( h : & Helper ,
1918 _: & Handlebars ,
2019 rc : & mut RenderContext ) -> Result < ( ) , RenderError > {
2120 if let Some ( param) = h. param ( 0 ) {
@@ -27,8 +26,7 @@ pub fn toml_escape_helper(_: &Context,
2726}
2827
2928/// html_escape_helper escapes strings in templates using html escaping rules.
30- pub fn html_escape_helper ( _: & Context ,
31- h : & Helper ,
29+ pub fn html_escape_helper ( h : & Helper ,
3230 _: & Handlebars ,
3331 rc : & mut RenderContext ) -> Result < ( ) , RenderError > {
3432 if let Some ( param) = h. param ( 0 ) {
@@ -170,7 +168,8 @@ mod test {
170168 handlebars. register_helper ( "toml-escape" , Box :: new ( toml_escape_helper) ) ;
171169 let mut data = BTreeMap :: new ( ) ;
172170 data. insert ( "name" . to_owned ( ) , "\" Iron\" Mike Tyson" . to_owned ( ) ) ;
173- let result = handlebars. template_render ( "Hello, {{#toml-escape name}}{{/toml-escape}}" , & data) . unwrap ( ) ;
171+ let template_string = r#"Hello, {{#toml-escape name}}{{/toml-escape}}"# ;
172+ let result = handlebars. template_render ( template_string, & data) . unwrap ( ) ;
174173 assert_eq ! ( result, "Hello, \" \\ \" Iron\\ \" Mike Tyson\" " ) ;
175174 }
176175
0 commit comments