JsRender Demos

Example Scenario: Custom tag and helper for assigning/getting local variables.

Note: This scenario implies understanding the processing sequence of template rendering,
and is somewhat in contradiction with the 'logicless' and declarative philosophy.
However it illustrates the power of the custom tags and helper function extensibility,
and is useful in certain advanced scenarios.
Declare setvar custom tag and getvar custom helper function
var vars = {};

    setvar: function(key, value) {
        vars[key] = value;

    getvar: function(key) {
        return vars[key];
Use {{setvar}} to assign values or rendered content to variable
{{setvar "summary" languages/}}
{{setvar "summary"}}
    <b>Subtitles only:</b> {{>subtitles}}
Use {{:~getvar}} to take values stored in the variable, and render them elsewhere in the template