diff --git a/lib/docx/containers/paragraph.rb b/lib/docx/containers/paragraph.rb index 2fd7eec..34004de 100755 --- a/lib/docx/containers/paragraph.rb +++ b/lib/docx/containers/paragraph.rb @@ -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 diff --git a/lib/docx/document.rb b/lib/docx/document.rb index de67206..a3e10de 100755 --- a/lib/docx/document.rb +++ b/lib/docx/document.rb @@ -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 diff --git a/spec/docx/document_spec.rb b/spec/docx/document_spec.rb index 760e6a7..28db70f 100755 --- a/spec/docx/document_spec.rb +++ b/spec/docx/document_spec.rb @@ -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