k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
981 stars 59 forks source link

Option to add boolean attributes #99

Closed shmargum closed 7 years ago

shmargum commented 7 years ago

I would like to add some boolean attributes. They are not standard, but i would like to specify them as an option in the config.

For example, to render a valid version of my page on Google AMP, I need to include several custom boolean attributes, and the page does not validate if they are not exactly as described. These attributes include amp and other amp specific attributes.

k0kubun commented 7 years ago

For some performance reasons, I don't want to add an option for that. Haml is slow because the number of options required on runtime is large. The option must make performance worse unless the option is a singleton.

In addition, I don't want to add method calls on runtime. So we should modify the single constant directly. This is the plugin for you. https://github.com/hamlit/hamlit-boolean_attributes