code: function renderTemplate(template, context) {
      var esc = $(document.createElement('div'));
  
      function handle(ph, escape) {
        var cur = context;
        $.each(ph.split('.'), function() {
          cur = cur[this];
        });
        return escape ? esc.text(cur || "").html() : cur;
      }
  
      return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
        return handle(arguments[2], arguments[1] == '%' ? true : false);
      });
    }
docs: A simple template renderer. Placeholders such as <%id%> are replaced
  by context['id'] with items being escaped. Placeholders such as <#id#>
  are not escaped.