BorisMoore / jsrender

A lightweight, powerful and highly extensible templating engine. In the browser or on Node.js, with or without jQuery.
http://www.jsviews.com
MIT License
2.67k stars 339 forks source link

Override default converter ":" ">" #327

Closed Dineshkanin closed 6 years ago

Dineshkanin commented 6 years ago

How to override default converters in jsrender.

BorisMoore commented 6 years ago

I'm travelling at the moment so can't reply until after returning on the 20th

BorisMoore commented 6 years ago

The built-in converters are

http://www.jsviews.com/#convertersapi@html

You should be able to override them by declaring your own, as in:

$.views.converters("html", myConverterFunction);
$.views.converters("attr", myConverterFunction);
$.views.converters("url", myConverterFunction);

However the first one does not work with the current implementation. I'll fix it in the next update. As a temporary workaround (which will no longer work after the fix) you can instead write:

$.views.sub._html = myConverterFunction;

BorisMoore commented 6 years ago

This has been fixed in commit 89