edwindj / whisker

{{mustache}} for R

Home Page:https://mustache.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with {{, even when changing delimiters

gerrymanoim opened this issue · comments

I've been trying to get whisker working with LaTeX (which uses a lot of braces)

At first I thought it wouldn't be an issue since there's proper nesting:

> template <- 
+ 
+ 'Hello {{{{name}}}}
+ You have just won ${{value}}!
+ 
+ '
> text <- whisker.render(template, data)
> cat(text)
Hello 
You have just won $10000!

So I thought, fine, I'll just switch the delimeters:

> template <- 
+ '
+ {{=<% %>=}}
+ Hello {{<%name%>}}
+ You have just won ${{<%value%>}}!
+ 
+ '
> text <- whisker.render(template, data)
> cat(text)

Hello ~~~~~~~~~~~~~Chris{{
You have just won $}}10000~~~~~~~~~~~~~!

Which is a bit weird? Apologies if I'm just doing something incorrectly.

Is this issue still on the agenda? This blocks us in the linked PR above.

The new delimiter (<%) should not include the {{= part, so your template should be:

{{=<% %>=}}
Hello <%name%>
You have just won $<%value%>!