var t = jsontemplate.Template("{# This is a comment and will be removed from the output.}\n\n <p> Found before {.if before?} yes {.or} no {.end} </p>\n", {more_predicates: more_predicates});
var s = t.expand( {"before": 1} );
document.getElementById("replace").innerHTML = s;
}
function more_predicates(predicate_name){
if (predicate_name.match(/^before\?/)) {
return function(unused, context){
try {
return context.get('before');
}
catch(err) {
if (err.name == 'UndefinedVariable') {
return false;
}
else {
throw err;
}
}
}
}
}
</script>
</head>
<body onload="write();">
<h4>Here is the same example rendered in JavaScript. <b>View Source</b> to