Skip to content

A templating plugin. Originally from Microsoft that was abandoned, we have continued development.

Notifications You must be signed in to change notification settings

JohnXu/jquery-tmpl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Templates plugin 1.0.1

This is the fork of jQuery Templates that we use internally here at Kanban Solutions. We have fixed all known and encountered bugs as well as changing the syntax from the standard

Docs

.tmpl() jQuery.tmpl() .template() jQuery.template()

{%= fieldNameOrExpression %}

Used for insertion of data values in the rendered template. Evaluates the specified field (property) on the current data item, or the specified JavaScript function or expression.

identical to the ${} tag of the origional jQuery Templates http://api.jquery.com/template-tag-equal/

{%html fieldNameOrExpression %}

Used for insertion of HTML markup strings in the rendered template. Evaluates the specified field on the current data item, or the specified JavaScript function or expression.

identical to the {{html}} tag of the origional jQuery Templates http://api.jquery.com/template-tag-html/

{%if fieldNameOrExpression %}

Used for conditional insertion of content. Renders the content between the opening and closing template tags only if the specified data item field, JavaScript function or expression does not evaluate to false (or to zero, null, type "undefined", or the empty string ).

identical to the {{if}} tag of the origional jQuery Templates http://api.jquery.com/template-tag-if/

{%elif fieldNameOrExpression %}

Used in association with the {{if}}...{{/if}} tag to provide alternative content based on the values of one or more expressions. The {%elif%} tag can be used with a parameter, as in: {%if a%}...{%elif b%}...{%/if%}.

Added because the old system actualy overloaded the else tag to handle elif as well and I didnt like that

{%else%}

Used in association with the {{if}}...{{/if}} tag to provide alternative content based on the values of one or more expressions. The {%else%} tag can be used without a parameter, as in: {%if a%}...{%elif b%}...{%else%}...{%/if%}

almost identical to the {{else}} tag of the origional jQuery Templates http://api.jquery.com/template-tag-else/ but I removed the ability to do {{else _test_}}

{%each( index, value ) collection %}

Used to iterate over a data array, and render the content between the opening and closing template tags once for each data item.

identical to the {{each}} tag of the origional jQuery Templates http://api.jquery.com/template-tag-each/

{%tmpl( [data], [options] ) template %}

Used to iterate over a data array, and render the content between the opening and closing template tags once for each data item.

identical to the {{tmpl}} tag of the origional jQuery Templates http://api.jquery.com/template-tag-tmpl/

{%wrap( [data], [options] ) template %}

Used for composition of templates which incorporate wrapped HTML content. Rendered template items can combine wrapped HTML content with template markup.

identical to the {{wrap}} tag of the origional jQuery Templates http://api.jquery.com/template-tag-wrap/

About

A templating plugin. Originally from Microsoft that was abandoned, we have continued development.

Resources

Stars

Watchers

Forks

Packages

No packages published