Skip to content

Commit 34b0adc

Browse files
author
Pranav Babu
committed
Do not use append_text
1 parent 885cecc commit 34b0adc

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/prawn/markup/processor/blocks.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,11 @@ def append_new_line
6363
def add_paragraph
6464
text = dump_text
6565
text.gsub!(/[^\n]/, '') if text.strip.empty?
66+
return if text.empty? && !treat_empty_paragraph_as_new_line?
6667

67-
if !text.empty?
68-
add_bottom_margin
69-
add_formatted_text(text, text_options)
70-
put_bottom_margin(text_margin_bottom)
71-
elsif text.empty? && treat_empty_paragraph_as_new_line?
72-
add_bottom_margin
73-
append_text("\n")
74-
put_bottom_margin(text_margin_bottom)
75-
end
68+
add_bottom_margin
69+
add_formatted_text(text.empty? ? "\n" : text, text_options)
70+
put_bottom_margin(text_margin_bottom)
7671
end
7772

7873
def add_current_text(options = text_options)

0 commit comments

Comments
 (0)