Start cleanup of codegen templates addresses #6

Change all raw output lines to sprintf so that everything lives inside
php tags. This makes everything a bit easier to digest.