Skip to content

Commit 40398fa

Browse files
authored
Merge pull request #51 from joelbarker2011/fix-newlines
Fix newlines
2 parents b137f71 + 089ab6f commit 40398fa

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/docx/document.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def to_s
101101

102102
# Output entire document as a String HTML fragment
103103
def to_html
104-
paragraphs.map(&:to_html).join('\n')
104+
paragraphs.map(&:to_html).join("\n")
105105
end
106106

107107
# Save document to provided path

spec/docx/document_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@
494494
it 'should output styled html' do
495495
expect(@formatted_line.to_html.scan('<span style="text-decoration:underline;"><strong><em>all</em></strong></span>').size).to eq 1
496496
end
497+
498+
it 'should join paragraphs with newlines' do
499+
expect(@doc.to_html.scan(%(<p style="font-size:11pt;">Normal</p>\n<p style="font-size:11pt;"><em>Italic</em></p>\n<p style="font-size:11pt;"><strong>Bold</strong></p>)).size).to eq 1
500+
end
497501
end
498502

499503
describe 'replacing contents' do

0 commit comments

Comments
 (0)