Skip to content

Commit

Permalink
add indent in document_spec, remove document API and pass document th…
Browse files Browse the repository at this point in the history
…rough paragrah constructor
  • Loading branch information
miko53 committed Oct 14, 2023
1 parent 4e459b0 commit 8245e15
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 1 addition & 4 deletions lib/docx/containers/paragraph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ def self.tag

# Child elements: pPr, r, fldSimple, hlink, subDoc
# http://msdn.microsoft.com/en-us/library/office/ee364458(v=office.11).aspx
def initialize(node, document_properties = {})
def initialize(node, document_properties = {}, doc = nil)
@node = node
@properties_tag = 'pPr'
@document_properties = document_properties
@font_size = @document_properties[:font_size]
end

def document=(doc)
@document = doc
end

Expand Down
4 changes: 1 addition & 3 deletions lib/docx/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ def update

# generate Elements::Containers::Paragraph from paragraph XML node
def parse_paragraph_from(p_node)
p = Elements::Containers::Paragraph.new(p_node, document_properties)
p.document = self
p
Elements::Containers::Paragraph.new(p_node, document_properties, self)
end

# generate Elements::Bookmark from bookmark XML node
Expand Down
2 changes: 1 addition & 1 deletion spec/docx/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@

describe 'reading style' do
before do
@doc = Docx::Document.open(@fixtures_path + '/test_with_style.docx')
@doc = Docx::Document.open(@fixtures_path + '/test_with_style.docx')
end

it 'read default style when not' do
Expand Down

0 comments on commit 8245e15

Please sign in to comment.