Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token } #17

Open
panosru opened this issue Sep 12, 2012 · 2 comments
Open

SyntaxError: Unexpected token } #17

panosru opened this issue Sep 12, 2012 · 2 comments

Comments

@panosru
Copy link

panosru commented Sep 12, 2012

Hi, I use Kiwi as my primary server side templating engine and I also use Handlebars with EmberJS for client-side so I tried today to do something like this: ${'{{action anActionName}}'|raw} but I got SyntaxError: Unexpected token } this works: {{raw}}{{action anActionName}}{{/raw}} but I think that the first should also work since I pass the raw filter.

Thanks :)

@pierreis
Copy link
Member

I think you made a mistake here. This is probably a naming issue however.
The raw tag has nothing in common with the raw filter. The first just avoids auto HTML escaping, whereas the latter instructs the parser to simply ignore the markup contained in it.

The SyntaxError is caused by the parser. It tends to bite when } is contained inside of a tag, even in strings. This will be fixed soon.

@panosru
Copy link
Author

panosru commented Sep 12, 2012

aha yes indeed I though that raw filter is a shortcut of raw tag, for instance when you have something short like the example above you could use ${'{{action anActionName}}'|raw} but when you have something more complex that would take more lines you would use:

<script type="text/x-handlebars" data-template-name="contributors">
  {{#each person in controller}}
    {{person.login}}
  {{/each}}
</script>

Regarding the html escape I would expect a safe filter instead that would mark the output as safe in order for the automatic escape to not convert html tags to entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants