Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/kss/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/section_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down