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

Support for literals is missing? #64

Open
nerdo opened this issue Feb 10, 2013 · 1 comment
Open

Support for literals is missing? #64

nerdo opened this issue Feb 10, 2013 · 1 comment

Comments

@nerdo
Copy link

nerdo commented Feb 10, 2013

It seems like there's no way to add literal text that would otherwise get interpreted as template tags.

For example, I'm using node.js + Backbone and would like to use doT as the template engine for the client and server side, so I've got a template that has something like this in it for the client:

<script type="text/x-dot-template" id="choice-template">
    <ul>
        {{~ it.question.choices :choice}}
        <li>{{=choice.get("label")}}</li>
        {{~}}
    </ul>
</script>

I don't want those script tags to be interpreted by doT on the server-side, because they're meant for the client-side to consume, but there doesn't seem to be a way to tell doT not to process parts of a template.

@epoberezkin
Copy link
Collaborator

One of the solution is to use <%%> for server side interpolation and {{}} for client side.

All you need to do is to change doT settings

I did it in koa-dot, for example, with a bit friendlier api.

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

No branches or pull requests

2 participants