Javascript emulation of Thymeleaf templating system