Nested function call template using Mustache.

126 views
Skip to first unread message

Ganesh Kumar

unread,
May 4, 2015, 8:44:29 AM5/4/15
to mustac...@googlegroups.com
I wanted to have a behaviour like this <br/>
        {{md5(sha1(base64Encoding({{someValue}})))}} <br/>
        {{sha1(base64Encoding({{someValue}}))}} <br/>

Can I achieve this kind of behaviour using mustache?

Teodor Dimov

unread,
May 4, 2015, 10:51:27 AM5/4/15
to mustac...@googlegroups.com
I guess you want to output the string {{md5(sha1(base64Encoding({{someValue}})))}} which will be some md5 string. you calculate this in the view not the template directly. i.e.
"my_md5_var" -> md5(sha1(base64Encoding(someValue)))
"my_sha1_var" -> sha1(base64Encoding(someValue))

 then use the result in the template:
  {{my_md5_var}} <br/>
        {{my_sha1_var}} <br/>
The point been to use the template only to display your result how you please(html etc). Operating aspect of the variable should remain in the language (Java etc).
Reply all
Reply to author
Forward
0 new messages