Simple search replace based templating language in Javascript