Cocoanetics/DTCoreText — pull request #480 by amro (2013-06-06 15:13:42+00:00)
Title: Adds support for arbitrary HTML attributes to NSAttributedString+HTML

New pull request with the cherry-picked commit. I couldn't figure out how to amend the other pull request.

DTHTMLElement now keeps HTML attributes in a dictionary in NSAttributedString's attributes. The idea is to segregate HTML attributes from general attributes.

This is useful when building an editor that mimics web-based editors that provide classes or special attributes to style elements. Another use is setting attributes like "target" or "title" on links based on UI.

These attributes are written out, with a few exceptions, by DTHTMLWriter. I'm not entirely happy with how I currently filter in DTHTMLWriter so please give feedback on that if you like. I'm also not sure my list is all encompassing (e.g. "src" attribute on images).

The class attribute is only written if DTHTMLWriter is asked to generate an HTML fragment so as not to stomp on the class attribute it generates in document mode.

I also added a single test to make sure parsing happened.