Allow {% set var %} in extends

Added ability to use 
```{% set var = 'value' %}``` in extending templates.
They will override the base variables if exist, or add new ones.
Required some global-ish refactor.
Please look at it and let me know if it is acceptable and needed. I might have missed some use cases in tests.