From b71c9fc4be5b918628f47a188112162878d2ccbc Mon Sep 17 00:00:00 2001 From: johny Date: Fri, 13 Dec 2013 16:53:01 -0500 Subject: [PATCH] Fix multiline modifier on indent --- lib/kss/section.rb | 5 ++--- test/section_test.rb | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/kss/section.rb b/lib/kss/section.rb index 25496d7..c4a8a15 100644 --- a/lib/kss/section.rb +++ b/lib/kss/section.rb @@ -63,14 +63,13 @@ def modifiers next if line.strip.empty? indent = line.scan(/^\s*/)[0].to_s.size - if last_indent && indent > last_indent + if last_indent && indent >= last_indent modifiers.last.description += line.squeeze(" ") else modifier, desc = line.split(" - ") modifiers << Modifier.new(modifier.strip, desc.strip) if modifier && desc + last_indent = indent + 1 end - - last_indent = indent end modifiers diff --git a/test/section_test.rb b/test/section_test.rb index 29e4138..c67c94a 100644 --- a/test/section_test.rb +++ b/test/section_test.rb @@ -12,6 +12,8 @@ def setup :disabled - Dims the button when disabled. .primary - Indicates button is the primary action. .smaller - A smaller button + for when the action + needs less emphasis. Styleguide 2.1.1. comment @@ -39,6 +41,10 @@ def setup assert_equal '2.1.1', @section.section end + test "parses a modifier's multiline description" do + assert_equal 'A smaller button for when the action needs less emphasis.', @section.modifiers.last.description + end + test "parses word phrases as styleguide references" do @comment_text.gsub!('2.1.1', 'Buttons - Truly Lime') section = Kss::Section.new(@comment_text, 'example.css')