tests: Add a testcase for template_escape()

In order not to break template_escape() functionality, add a test case
for basic functionality testing.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
templates: Respect the template_escape() in template functions

When a template function creates a template itself, make the new
template inherit the escape setting from the parent.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>