Skip to content

Commit

Permalink
Skip empty lines at the end of paragraph block. Closes #882
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuto committed Dec 11, 2017
1 parent 3fc9e8a commit 7162c9f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/review/textutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def detab(str, ts = 8)
def split_paragraph(lines)
pre = pre_paragraph
post = post_paragraph
lines.pop while lines[lines.size - 1] && lines[lines.size - 1].strip.empty?

blocked_lines = [[]]
lines.each do |element|
Expand Down
2 changes: 2 additions & 0 deletions test/test_textutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def test_split_paragraph_p
assert_equal ['<p>abc</p>', '<p>def</p>'], ret
ret = @tu_p.split_paragraph(['abc', '', '', 'def', 'ghi'])
assert_equal ['<p>abc</p>', '<p>defghi</p>'], ret
ret = @tu_p.split_paragraph(['abc', '', '', 'def', 'ghi', '', ''])
assert_equal ['<p>abc</p>', '<p>defghi</p>'], ret
end

def test_split_paragraph_nil
Expand Down
2 changes: 1 addition & 1 deletion test/test_topbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_inline_in_table

def test_dlist_beforeulol
actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
assert_equal %Q(★foo☆\n\tfoo.\n\t\n\npara\n\n★foo☆\n\tfoo.\n\t\n\n1\tbar\n\n★foo☆\n\tfoo.\n\t\n\n\tbar\n\n), actual
assert_equal %Q(★foo☆\n\tfoo.\n\npara\n\n★foo☆\n\tfoo.\n\n1\tbar\n\n★foo☆\n\tfoo.\n\n\tbar\n\n), actual
end

def test_paragraph
Expand Down

0 comments on commit 7162c9f

Please sign in to comment.