added option to provide template context as locals