Making @class values HTML-safe
XSweet produces HTML 'class' attributes with labels reflecting Word Styles ("Paragraph Styles" and "Character Styles") assigned in the source document.
We are already normalizing these names into HTML-safe versions by removing spaces and other unwanted characters, but at risk of confusion when there are name collisions (in the rare case where a document has both "Header 1" and "Header1" styles, and they are different). We are also not making provision for some peculiarities of HTML @class, such as the fact that they are not case-sensitive.
A separate filter to rewrite style names to safe values would account for all of this properly. It should:
- Remove spaces and unwanted characters
- Cast to lower case
- Relabel and resulting collisions with distinguishing suffixes.
This needs to happen both on @class, and inside enclosed CSS (wherein classes are referenced), for comprehensiveness.