Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's kinda neat. I assume it only supports built-in filters and control structures?


The compiler output looks roughly like this:

  var Jasinja = {
    "filters": {
      "attr": function(obj, name) { return obj[name]; }
    },
    "tests": {
      "lower": function(val) { return val.toLowerCase() == val; }
    },
    "templates": {
      "test": {
        "macros": {},
        "blocks": {},
        "render": function(ctx, tmpl) {
          return "a";
        }
      }
    }
  };
So you can easily add some filters by setting Jasinja.filters['myfilter'] to a function.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: