Skip to content
This repository

Custom delimiters broken #153

Closed
AlexeyUzhva opened this Issue August 23, 2012 · 8 comments

4 participants

AlexeyUzhva Boris Moore Niels R. king5699
AlexeyUzhva

{{ and }} are reserved in Django. So I'm trying to change it into {? and ?}

This code works on older jsrender versions but not on current one

<script>
    jQuery.views.delimiters("{?","?}");
</script>
Boris Moore
Owner

Yes, that looks like a bug I noticed recently and which should be fixed in an upcoming update I am working on. It's a major update, so may be a few days before I am able to commit it...

AlexeyUzhva

Thank you for so fast response!

So I'm looking forward for this release and staying with old version for now:)

Niels R.

Any idea which is the last version where the custom delimiters aren't broken?

I'm using jsRender in my MVC templates which already use the {{ }} delimiters for server-side rendering.

I'm currently using a very old version where {{for ...}} is still {{#each ...}} and integers with value 0 are rendered as empty strings...

Boris Moore
Owner

You probably have to go back at least to this.
The error was likely introduced here (May 25th)

Boris Moore BorisMoore referenced this issue from a commit December 02, 2012
Boris Moore Commit counter 22. Major update, including some BREAKING CHANGES, and…
… many

new features. More samples and documentation for new features will be added
incrementally in coming updates.

Among the changes:

Detailed APIs modified for consistent arguments and use of this
pointer, and for maximum extensibility. See updated samples for usage...

Compiled templates restructured for easier debugging.

View object restructured for clarity.

View now has a type property, e.g. type="item"
Only "item" views have index properties, but to get the index from a nested
view use view.get("item").index.

nodes collection on a view is now a function, view.nodes().

Settings grouped onto a $.views.settings object.
View navigation features improved, with view.get(...) and $.view(elem, ...)
tagCtx object provides improved access to the args and properties of a tag
 invocation.

Adding resources (helpers, converters, tags, etc) to a template now supported
by passing parent template to API. e.g. $.tags({...}, parentTemplate).
Many improvements to custom tags, - used also as part of JsViews integration
for new JsViews Tag Controls. (Instantiation of tags as control instances).

Template inclusion now supported with simpler syntax {{for tmpl=.../))

Fixes for issues #169, #162, #157, #156, #155, #153, #145
69ce6ce
Boris Moore
Owner

This has been fixed in commit 22. Please reopen if the fix does not work for you. Thanks!

Boris Moore BorisMoore closed this December 03, 2012
king5699

I'm using django too.The delimiter ''{{'',"{%" are reserved characters in django.How can I replace them with "<<","<%" in the current version? I read JsRender API,but I still don't how to customize the delimiters, not to customize tags.

Boris Moore
Owner

@king5699:

There's an example in the unit tests:

https://github.com/BorisMoore/jsrender/blob/master/test/unit-tests/tests-jsrender-no-jquery.js#L509

For example:

$.views.settings.delimiters("@%","%@");
king5699

I got it.Thanks very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.