class Caracal::Renderers::PackageRelationshipsRenderer
Public Instance Methods
to_xml()
click to toggle source
This method produces the xml required for the `word/settings.xml` sub-document.
# File lib/caracal/renderers/package_relationships_renderer.rb, line 17 def to_xml builder = ::Nokogiri::XML::Builder.with(declaration_xml) do |xml| xml.send 'Relationships', root_options do relationship_data.each_with_index do |rel, index| xml.send 'Relationship', { 'Target' => rel.first, 'Type' => rel.last, 'Id' => "rId#{ index + 1 }" } end end end builder.to_xml(save_options) end
Private Instance Methods
relationship_data()
click to toggle source
# File lib/caracal/renderers/package_relationships_renderer.rb, line 34 def relationship_data [ ['docProps/app.xml', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties'], ['docProps/core.xml', 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties'], ['docProps/custom.xml', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties'], ['word/document.xml', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'] ] end
root_options()
click to toggle source
# File lib/caracal/renderers/package_relationships_renderer.rb, line 43 def root_options { 'xmlns' => 'http://schemas.openxmlformats.org/package/2006/relationships' } end