1 2 3 4 5 6 7 8 9 10 11 12 13 | $.extend($.template.regx, {django: /\{\{\s*([\w-]+)(?:\|([\w\.]*)(?:\:(.*?)?[\s\}])?)?\s*\}\}/g});
$.template.regx.standard = $.template.regx.django;
// test code
var template = $.template("<div>hello {{ name|substr:0,10 }}!!!</div>");
$(selector).append(template, {
name: 'abcdefghijkl'
});
// or
var html = template.apply( {
name: 'abcdefghijkl'
});
|
More like this
- Django Template "include_raw" tag by wwu.housing 3 years, 9 months ago
- Client-side Django-style date & time string formatting by robbie 6 years, 2 months ago
- Orderable inlines using drag and drop with jQuery UI by simon 4 years, 8 months ago
- Add special field lookups to the Admin list_filter display by whiteinge 5 years, 3 months ago
- jQuery slugify plugin by girasquid 4 years ago
Comments