evanmiller/ChicagoBoss — pull request #180 by fdevibe (2013-01-15 13:32:00+00:00)
Title: Add template context processors ability.

This allows for arbitrary modules and funs to be called with given sets of arguments before rendering templates, where the funs return two-tuples of template variables and their values (e.g. {season, "winter"}). These variables will then be valid for all templates.
To enable, add
```erlang
{template_context_processors, L}
```
to boss.config, where L is a list of three-tuples, {Module, Fun, Arity} describing the context processor funs to be called. Arity can be either 2 (in which case the fun will be called with Request and SessionID arguments) or 5 (in which case also Lang, AppInfo and Variables) will be added to the call.

### Example:
In src/lib/user_lib.erl, define the fun
```erlang
request_in_templates(Req, SessionID) ->
{request, Req}.
```
Then, add
```erlang
{template_context_processors, [{user_lib, request_in_templates, 2}]}
```
to boss.config. Now the request object will be available to all templates, in the request variable.