This is another place where I think underscore templates would be helpful.