Remove trailing whitespace.
Lowercase, hyphenate and normalise tags.