Posted Sun, 04 Jan 2015 10:42:30 GMT in reply to
Sönke Ludwig
Reply
On Sat, 22 Sep 2012 14:34:48 +0200, Sönke Ludwig wrote:
Am 22.09.2012 01:09, schrieb Eldar Insafutdinov:
For some specific reasons I wanted not to escape the template
parameters. I was about to modify diet to provide an option of not doing
it, before I came up with quite an elegant trick. Because Diet calls
htmlEscape function to do escaping I realised that I could pass my own
symbol with the same name to override the default behavior:
auto htmlEscape = (string a) { return a; };
res.render!("signup.dt", htmlEscape, data);
Interesting idea ;)
Btw., it's not yet documented, but you can now also use !{} on master to
make unescaped string interpolations and attributes and element text are
not getting escaped anymore - the former behavior didn't really make
sense and actually double-escaped attributes.
Hi everyone. Sorry to come in quite late. I would like to complete one of your remark for the purpose of clarity.
"!{} on master" actually means that in *.dt files, that is diet templates, you can dynamically bind variable name into templates using !{} notation instead of #{} notation.
Example :
// index.dt
doctype html
html
head
title #{l_pageName} // the contents of this variable is html escaped
body
p !{l_content} // the contents of this variable is not html escaped
I hope that will help.
Romain