nosamanuel / cottonmouth

Pure-Python HTML generation
BSD 3-Clause "New" or "Revised" License
15 stars 5 forks source link

Append string classnames from extra attributes #4

Closed nosamanuel closed 7 years ago

nosamanuel commented 7 years ago

Rendering was crashing when a string was passed in the extra class attribute. Passing a string is a perfectly reasonable thing to do and is supported by Hiccup, so now it works here too.

The assumption I originally made was that the explicit class defined by tag.className would be an invariant, and class would be an optional list of additional classnames passed in the the attributes that would be appended to the invariant classnames. This is now officially documented and tested, with additional support for string-encoded classnames.

Incidental cleanup: the sugar for rendering .foo as a div element was not implemented and was necessary for clear documentation.

Closes #1.

metasoarous commented 7 years ago

Looks good to me!