Skip to content

Commit 622a4a8

Browse files
committed
Fixing extra paragraph after multiple inserted lines, fixing incorrect test for presence of text runs
1 parent d5f70e7 commit 622a4a8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/docx/elements/bookmark.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def insert_multiple_lines(text_array)
3030
# Remove text from paragraph
3131
paragraph.blank!
3232
paragraphs << paragraph
33-
for i in 0..(text_array.size - 1)
33+
for i in 0...(text_array.size - 1)
3434
# Copy previous paragraph
3535
new_p = paragraphs[i].copy
3636
# Insert as sibling of previous paragraph
@@ -48,7 +48,7 @@ def get_run_before
4848
# at_xpath returns the first match found and preceding-sibling returns siblings in the
4949
# order they appear in the document not the order as they appear when moving out from
5050
# the starting node
51-
if (r_nodes = @node.xpath("./preceding-sibling::w:r"))
51+
if not (r_nodes = @node.xpath("./preceding-sibling::w:r")).empty?
5252
r_node = r_nodes.last
5353
Containers::TextRun.new(r_node)
5454
else

test/fixtures/~$diting.docx

-162 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)