Add NewWithString and WriteIfChanged in templateutil and a test for them.