Format tpl code