lib/rabbit/readme-parser.rb in rabbit-2.0.6 vs lib/rabbit/readme-parser.rb in rabbit-2.0.7

- old
+ new

@@ -36,14 +36,20 @@ parse_content(File.read(path)) end private + HEADING_MARK_RE = /\A(?:[=*!]+|h\d\.)\s*/ def parse_content(content) blocks = content.split(/(?:\r?\n){2,}/) if blocks[0] - @title = blocks[0].gsub(/\A(?:[=*!]+|h\d\.)\s*/, "") + @title = blocks[0].gsub(HEADING_MARK_RE, "") end - @description = blocks[1] + first_paragraph_blocks = [] + blocks[1..-1].each do |block| + break if HEADING_MARK_RE =~ block + first_paragraph_blocks << block + end + @description = first_paragraph_blocks.join("\n\n") end end end