alexcoplan / sculpt

An HTML generator in Ruby. Syntax is everything.
http://alexcoplan.co.uk/sculpt
MIT License
10 stars 2 forks source link

data attributes are super awkward #2

Closed logicalhan closed 12 years ago

logicalhan commented 12 years ago
Sculpt.render_doc do
  div "data-blah".to_sym => 'blah'    
end

this will prevent adoption, imo.

alexcoplan commented 12 years ago

That is a really good point.. you can currently get around it by quoting the attributes like so:

Sculpt.render_doc do
    div "my div content", "data-foo"=>'x', "data-bar"=>'y'
end

But obviously the sym syntax for hashes is much nicer.

Might have to add an option to Sculpt which is true by default to replace underscores with dashes in syms when they are actually outputted.

logicalhan commented 12 years ago

dur.. i didn't consider omitting the to_sym part and just using the old-style hash. :/ i'm stupid, sorry.

..using the old-style hash does feel a bit 1.8.7 though..

alexcoplan commented 12 years ago

Have now added the option Sculpt.smart_attrs. It basically replaces underscores in sym keys with dashes. See the the changelog for more info.