code snippets generation
clean up and fix unclosed tags in templates