mozilla/nunjucks — pull request #239 by garygreen (2014-05-30 16:33:10+00:00)
Title: Added ability to add/customize globals with: addGlobal(name, func)

With this, you'll be able to add global functions for use in your templates:

env->addGlobal('some_function', function() { return 'hello'; });

In your template:

{{ some_function() }}
# Outputs 'hello'