Implement JavaScript template engine