Improving template generation.

Making the template generator line break exercises only on whitespace
rather than in the middle of words.