From ab88d002f90ef99e6d9e3415e6256265480cc654 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Fri, 27 Mar 2015 21:55:41 +0900 Subject: [PATCH] Fix fatal mistake in new attribute compiler --- lib/hamlit/new_attribute_compiler.rb | 4 ++-- spec/hamlit/engine/new_attribute_spec.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/hamlit/new_attribute_compiler.rb b/lib/hamlit/new_attribute_compiler.rb index c96a6901..1679784c 100644 --- a/lib/hamlit/new_attribute_compiler.rb +++ b/lib/hamlit/new_attribute_compiler.rb @@ -42,8 +42,8 @@ module Hamlit token = tokens.first break unless token - pos = token.first.last - str = str[(pos - 1)..-1] + pos = token.first.last + str = str[pos..-1] end attributes diff --git a/spec/hamlit/engine/new_attribute_spec.rb b/spec/hamlit/engine/new_attribute_spec.rb index 24a93c3b..e7523b99 100644 --- a/spec/hamlit/engine/new_attribute_spec.rb +++ b/spec/hamlit/engine/new_attribute_spec.rb @@ -7,5 +7,13 @@ describe Hamlit::Engine do

bar

HTML end + + it 'renders multiple attributes' do + assert_render(<<-HAML, <<-HTML) + %p(a=1 b=2) bar + HAML +

bar

+ HTML + end end end