Make wrapping templates in at-directive part of encoding phase