diff --git a/lib/hamlit/compilers/new_attribute.rb b/lib/hamlit/compilers/new_attribute.rb index f889bbac..a51b2564 100644 --- a/lib/hamlit/compilers/new_attribute.rb +++ b/lib/hamlit/compilers/new_attribute.rb @@ -25,7 +25,11 @@ module Hamlit tokens = Ripper.lex(str) key = read_key!(tokens) val = read_value!(tokens) - attributes[key] = val if key && val + if key && val + attributes[key] = val + elsif key + attributes[key] = 'true' + end token = tokens.first break unless token @@ -40,15 +44,14 @@ module Hamlit def read_key!(tokens) skip_tokens!(tokens, :on_sp) (row, col), type, key = tokens.shift - - skip_tokens!(tokens, :on_sp) - (row, col), type, str = tokens.shift - raise SyntaxError if str != '=' - key end def read_value!(tokens) + skip_tokens!(tokens, :on_sp) + (row, col), type, str = tokens.shift + return nil if str != '=' + skip_tokens!(tokens, :on_sp) return if tokens.empty? diff --git a/spec/haml_spec.rb b/spec/haml_spec.rb index cc6b76f1..4c39b69a 100644 --- a/spec/haml_spec.rb +++ b/spec/haml_spec.rb @@ -476,8 +476,7 @@ describe "haml" do assert_ugly(haml, locals, options) end - # FIXME: currently this is not considered - pending "HTML-style tag with an atomic attribute" do + specify "HTML-style tag with an atomic attribute" do haml = %q{%a(flag)} html = %q{} locals = {}