Maybe I should use 2 recursion: one for parse template and one for build html