Add builder pattern for paragraph, lists, tables

This commit is contained in:
2025-12-02 10:57:54 +01:00
parent 50c9c20eca
commit b602b2a2ff
25 changed files with 1248 additions and 47 deletions

View File

@@ -14,13 +14,19 @@ module Ezdoc
zipfile.get_output_stream("_rels/.rels") { |f| f.write(relationships_xml) }
zipfile.get_output_stream("word/_rels/document.xml.rels") { |f| f.write(document_relationships_xml) }
zipfile.get_output_stream("word/document.xml") { |f| f.write(document_xml) }
zipfile.get_output_stream("word/numbering.xml") { |f| f.write(numbering_xml) } if lists?
end
end
private
def lists?
@document.lists.any?
end
def content_types_xml
Xml::ContentTypes.new.to_xml
Xml::ContentTypes.new(has_numbering: lists?).to_xml
end
def relationships_xml
@@ -28,11 +34,15 @@ module Ezdoc
end
def document_relationships_xml
Xml::DocumentRelationships.new.to_xml
Xml::DocumentRelationships.new(has_numbering: lists?).to_xml
end
def document_xml
Xml::DocumentXml.new(@document.content).to_xml
Xml::DocumentXml.new(@document.nodes).to_xml
end
def numbering_xml
Xml::Numbering.new(@document.lists).to_xml
end
end
end