Navigation Menu

Skip to content

Commit

Permalink
Add new line between page
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Feb 16, 2014
1 parent 0fa7b32 commit d6cefcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/chupa-text/decomposers/pdf.rb
Expand Up @@ -32,7 +32,10 @@ def decompose(data)
document = Poppler::Document.new(data.body)
text = ""
document.each do |page|
text << page.get_text
page_text = page.get_text
next if page_text.empty?
text << "\n" unless text.empty?
text << page_text
end
text_data = TextData.new(text)
text_data.uri = data.uri
Expand Down
2 changes: 1 addition & 1 deletion test/test-pdf.rb
Expand Up @@ -125,7 +125,7 @@ def decompose

sub_test_case("multi pages") do
def test_body
assert_equal(["Page1Page2"], decompose.collect(&:body))
assert_equal(["Page1\nPage2"], decompose.collect(&:body))
end

private
Expand Down

0 comments on commit d6cefcf

Please sign in to comment.